MATLAB Answers

Syntax error in simulink

12 views (last 30 days)
Quamar Niyaz
Quamar Niyaz on 18 Jul 2016
Commented: Mark McBroom on 14 Nov 2020
Getting syntax error in Simulink for this expression
The equation seems correct. Can anyone explain it?
Shoanaliy Arul
Shoanaliy Arul on 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

Sign in to comment.

Answers (1)

Mark McBroom
Mark McBroom on 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 Comment
Mark McBroom
Mark McBroom on 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.

Sign in to comment.




Community Treasure Hunt

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

Start Hunting!