Curve fitting scripts in Matlab