161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
|
mxSetName (MTT_MATLAB_P, "MTT_P");
p = mxGetPr (MTT_MATLAB_P);
for (i = 0; i < MTTNPAR; i++) {
p[i] = mttpar[i];
}
mexPutArray (MTT_MATLAB_P, "base");
/* call fsolve */
mexEvalString ("MTT_Ui = fsolve (@<mtt_model_name>_sfun_ae, MTT_Ui, optimset('display','off','diagnostics','off'), 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++) {
mttu[MTTNU + i] = p[i];
}
|
|
|
|
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
|
mxSetName (MTT_MATLAB_P, "MTT_P");
p = mxGetPr (MTT_MATLAB_P);
for (i = 0; i < MTTNPAR; i++) {
p[i] = mttpar[i];
}
mexPutArray (MTT_MATLAB_P, "base");
/* call solver */
mexEvalString ("MTT_Ui = lsqnonlin (@<mtt_model_name>_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++) {
mttu[MTTNU + i] = p[i];
}
|