added some matlab code