10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
#include <stdio.h>
#include <stdlib.h>
#include "simstruc.h"
#include "sfun_debug.h"
#include "useful-functions.hh"
#include "<mtt_model_name>_def.h"
#include "<mtt_model_name>_sympar.h"
static double *mttdx; /* pointer to rates */
static double *mttu; /* pointer to inputs */
static double *mttpar; /* pointer to parameters */
static double *mttx; /* pointer to states */
static double *mtty; /* pointer to outputs */
static double *mttyz; /* pointer to residuals */
|
>
|
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
#include <stdio.h>
#include <stdlib.h>
#include "simstruc.h"
#include "sfun_debug.h"
#include "useful-functions.hh"
#include "<mtt_model_name>_def.h"
#include "<mtt_model_name>_sympar.h"
#include "<mtt_model_name>_cr.h"
static double *mttdx; /* pointer to rates */
static double *mttu; /* pointer to inputs */
static double *mttpar; /* pointer to parameters */
static double *mttx; /* pointer to states */
static double *mtty; /* pointer to outputs */
static double *mttyz; /* pointer to residuals */
|
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
|
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'), 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];
}
|
|
|
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
|
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];
}
|