working matlab code