Compmethods-004 course. Pretty much the matlab code translated to scipy.