Syntax error , Component: Simulink, Category: Block error
18 次查看(过去 30 天)
显示 更早的评论
I am trying to create user defined function theta_2dot of inverted pedulum (cart and pole) using following formulas which is giving me syntax error
Formulas are : -(l*m*cos(u(3))*sin(u(3))*u(4)^2 + F*cos(u(3)) - g*m*sin(u(3)) - M*g*sin(u(3)))/(l*(M + m - m*cos(u(3))^2))
I would like to know correct format for above formulas.



Thank you, Aaron
0 个评论
回答(1 个)
Walter Roberson
2024-8-25
编辑:Walter Roberson
2024-8-25
Are you trying to use an Interpreted MATLAB Function block ? I think the formula is too complex for an Interpreted MATLAB block, and should be converted to a MATLAB Function block, or modeled with a whole series of Math blocks.
For one thing, I don't think Interpret MATLAB Function block recognizes variables (other than u). It just might possibly recognize variables that have been assigned in the base workspace... I'm not sure.
Note that these days, Interpreted MATLAB Function blocks are recommended against, and will be removed from some later MATLAB release (probably R2025a)
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Simulink Functions 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!