invalid operands to binary *
Ältere Kommentare anzeigen
Hello MATLAB team, I've been working on a project with Simulink and code on C and I find these two errors when I try to compile the sistem:
invalid operands to binary * (have 'real_T ' and 'double') tempXk_mu[0]=(A[0][0]*Xk_mu[0]+A[0][1]*Xk_mu[1]+A[0][2]*Xk_mu[2])+B[0](Ureal-qe0)+ke1*((Xk[2]-h30)-C[0]*Xk_mu[0]);
and
invalid operands to binary * (have 'real_T ' and 'real_T') tempXk_mu[0]=(A[0][0]*Xk_mu[0]+A[0][1]*Xk_mu[1]+A[0][2]*Xk_mu[2])+B[0](Ureal-qe0)+ke1*((Xk[2]-h30)-C[0]*Xk_mu[0]);
I declared the matrices A, B and C as: double A[3][3]; double B[3][1]; double C[1][3]; and after I have them defined in another function like:
static void mdlUpdate(SimStruct *S, int_T tid)
{
real_T tempXk_mu[1] = {1.0};
real_T *Xk_mu = ssGetRealDiscStates(S);
InputRealPtrsType uPtrs0 = ssGetInputPortRealSignalPtrs(S,0);
InputRealPtrsType uPtrs1 = ssGetInputPortRealSignalPtrs(S,1);
real_T Tm = mxGetPr(ssGetSFcnParam(S,0))[0];
real_T *yPtrs0 = ssGetOutputPortRealSignal(S,0);
UNUSED_ARG(tid); /* not used in single tasking mode */
/* INCLUIR AQUÍ LA INICIALIZACIÓN DE LAS MATRICES A, B y C */
static real_T A[3][3]={{0.5383,0.10329,0.16453},{0.41321,0.084103,0.15593},{0.21945,0.051988,0.12786}};
static real_T B[3][1]={{1744.8},{1085.2},{397.6}};
static real_T C[1][3]={0,0,1};
/* INCLUIR AQUÍ EL OBSERVADOR */
tempXk_mu[0]=(A[0][0]*Xk_mu[0]+A[0][1]*Xk_mu[1]+A[0][2]*Xk_mu[2])+B[0]*(Ureal-qe0)+ke1*((Xk[2]-h30)-C[0]*Xk_mu[0]);
tempXk_mu[1]=(A[1][0]*Xk_mu[0]+A[1][1]*Xk_mu[1]+A[1][2]*Xk_mu[2])+B[1]*(Ureal-qe0)+ke2*((Xk[2]-h30)-C[1]*Xk_mu[1]);
tempXk_mu[2]=(A[2][0]*Xk_mu[0]+A[2][1]*Xk_mu[1]+A[2][2]*Xk_mu[2])+B[2]*(Ureal-qe0)+ke3*((Xk[2]-h30)-C[2]*Xk_mu[2]);
Xk_mu[0]=tempXk_mu[0];
Xk_mu[1]=tempXk_mu[1];
Xk_mu[2]=tempXk_mu[2];
}
I would like to know how to solve this problem with the operands
Thanks in advance.
Antworten (0)
Kategorien
Mehr zu MATLAB Report Generator finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!