plots and matlab implementation