Syntax error , Component: Simulink, Category: Block error

17 Ansichten (letzte 30 Tage)
Aaron
Aaron am 25 Aug. 2024
Bearbeitet: Walter Roberson am 25 Aug. 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

Antworten (1)

Walter Roberson
Walter Roberson am 25 Aug. 2024
Bearbeitet: Walter Roberson am 25 Aug. 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)

Kategorien

Mehr zu Simulink Functions finden Sie in Help Center und File Exchange

Produkte


Version

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by