Matlab stuff from grad school