Syntax error in simulink
Afficher commentaires plus anciens
Getting syntax error in Simulink for this expression
m*(u(1)-l*u(3)*u(3)*sin(u(2))+l*u(4)*cos(u(2)))
The equation seems correct. Can anyone explain it?
6 commentaires
Walter Roberson
le 18 Juil 2016
We will need more context and the complete error message.
For example that expression would not be valid in a MATLAB Function block because MATLAB Function block need a "function" header.
Quamar Niyaz
le 18 Juil 2016
Image Analyst
le 19 Juil 2016
I think you overlooked where he said "We will need ... the complete error message." That means ALL the red text from the command window.
Walter Roberson
le 19 Juil 2016
When I copy and paste your code into a Fcn block or Interpreted Fcn block in R2016a, I am not told of any error.
Quamar Niyaz
le 20 Juil 2016
Modifié(e) : Quamar Niyaz
le 20 Juil 2016
Shoanaliy Arul
le 12 Nov 2020
I am also getting the simular error.
Mine says:
The expression: m*(u(1) - l*u(3)*u(3)*sin(u(2)) + l*u(4)*cos(u(2))) in 'Pend_Model/Subsystem/N' has a syntax error
Réponses (2)
Mark McBroom
le 14 Nov 2020
0 votes
The following variables need to be defined in the MATLAB workspace:
I, g, b, m, l, M
thetadot is missing a paren. It hsould be:
1/I*(-u(1)*cos(u(3)) - u(2)*sin(u(3)))
1 commentaire
Mark McBroom
le 14 Nov 2020
Note. I debugged this by cutting and pasting each of the equations into the MATLAB workspace. This gives more detailed info on undefined variables and syntax errors.
Diki
le 14 Sep 2024
0 votes
Error:The expression: (-1/(J/(R^2)+m))*(m*g*sin(u(3))-m*u(1)*(u(4)^2)
in 'RootLocus/Ball and Steam/Fcn'
has a syntax error
Catégories
En savoir plus sur General Applications dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!