added more matlab code