finished comparing to matlab