Matlab Code for OSH