Matlab/octave code for motion analysis