Syntax error in simulink
显示 更早的评论
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 个评论
Walter Roberson
2016-7-18
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
2016-7-18
Image Analyst
2016-7-19
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
2016-7-19
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
2016-7-20
编辑:Quamar Niyaz
2016-7-20
Shoanaliy Arul
2020-11-12
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
回答(2 个)
Mark McBroom
2020-11-14
0 个投票
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 个评论
Mark McBroom
2020-11-14
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
2024-9-14
0 个投票
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
类别
在 帮助中心 和 File Exchange 中查找有关 General Applications 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!