Index: mttroot/mtt/lib/rep/sfun_rep/sfun.c.tmpl ================================================================== --- mttroot/mtt/lib/rep/sfun_rep/sfun.c.tmpl +++ mttroot/mtt/lib/rep/sfun_rep/sfun.c.tmpl @@ -163,12 +163,12 @@ for (i = 0; i < MTTNPAR; i++) { p[i] = mttpar[i]; } mexPutArray (MTT_MATLAB_P, "base"); - /* call fsolve */ - mexEvalString ("MTT_Ui = fsolve (@_sfun_ae, MTT_Ui, optimset('display','off','diagnostics','off'), MTT_X, MTT_U, MTT_T, MTT_P);"); + /* call solver */ + mexEvalString ("MTT_Ui = lsqnonlin (@_sfun_ae, MTT_Ui, [], [], optimset('display','off','diagnostics','off','TolX',1e-2,'TolFun',1e-2), MTT_X, MTT_U, MTT_T, MTT_P);"); /* retrieve result */ MTT_MATLAB_Ui = mexGetArray ("MTT_Ui", "base"); p = mxGetPr (MTT_MATLAB_Ui); for (i = 0; i < MTTNYZ; i++) {