Effacer les filtres
Effacer les filtres

Syntax error in simulink

22 vues (au cours des 30 derniers jours)
Quamar Niyaz
Quamar Niyaz le 18 Juil 2016
Réponse apportée : Diki le 14 Sep 2024 à 15:49
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
Quamar Niyaz
Quamar Niyaz le 20 Juil 2016
Modifié(e) : Quamar Niyaz le 20 Juil 2016
I am trying to implement this example http://ctms.engin.umich.edu/CTMS/index.php?example=InvertedPendulum&section=SimulinkModeling. I have followed the procedure as specified in it, but getting the errors in the third function block which is as follows:
The expression: m*(u(1)-l*((u(3))^2)*sin(u(2))+l*u(4)*cos(u(2)))
in 'Sim_Exp7/Subsystem/Subsystem/N' has a syntax error
I have also attached my mdl and error files. My Matlab version is R2015b.
Shoanaliy Arul
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

Connectez-vous pour commenter.

Réponses (2)

Mark McBroom
Mark McBroom le 14 Nov 2020
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
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.

Connectez-vous pour commenter.


Diki
Diki le 14 Sep 2024 à 15:49
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 Event Functions dans Help Center et File Exchange

Produits


Version

R2015b

Community Treasure Hunt

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

Start Hunting!

Translated by