convert fix Matlab to C