Error: Invalid operands to binary /

11 visualizaciones (últimos 30 días)
yigui zhang
yigui zhang el 6 de Jul. de 2018
Editada: Image Analyst el 4 de Abr. de 2020
How can I solve this problem?
Error: Invalid operands to binary / (have 'real_T {aka const double}' and 'const real_T * {aka const double *}')
dx[3] = xC[11]*xC[4] - xC[10]*xC[5] + u[0]/Mass;
^
The '/' is where the error happens.

Respuestas (2)

Jiaming Wu
Jiaming Wu el 4 de Abr. de 2020
Editada: Image Analyst el 4 de Abr. de 2020
Change this
dx[3] = xC[11]*xC[4] - xC[10]*xC[5] + u[0]/Mass;
to
dx[3] = xC[11]*xC[4] - xC[10]*xC[5] + u[0]/Mass[0];

Image Analyst
Image Analyst el 6 de Jul. de 2018
MATLAB uses round parentheses, not square brackets, to indicate array elements. Arrays also start at 1, not 0.
dx(3) = xC(12) * xC(5) - xC(11) * xC(6) + u(1)/Mass

Categorías

Más información sobre Creating and Concatenating Matrices en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by