Nonlinear least squares problem of optimization method Matlab code