Matlab solutions