MatLab code I have done for class