Syntax error , Component: Simulink, Category: Block error

14 vues (au cours des 30 derniers jours)
Aaron
Aaron le 25 Août 2024
Modifié(e) : Walter Roberson le 25 Août 2024
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

Réponses (1)

Walter Roberson
Walter Roberson le 25 Août 2024
Modifié(e) : Walter Roberson le 25 Août 2024
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)

Catégories

En savoir plus sur Simulink Functions dans Help Center et File Exchange

Produits


Version

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by