Syntax Error Simulink fcn block

The expression: (-3*B*L*L*u(4))/J+(a*L*u(1))+(a*L*u(2))+(a*L*u(3)) in 'omnirobotcontrol/Subsystem/theta_2dot' has a syntax error.
WhY I am getting this error. I can't see the wrong :(

8 comentarios

madhan ravi
madhan ravi el 6 de Jun. de 2020
A picture of the model would help.
lokman alici
lokman alici el 6 de Jun. de 2020
lokman alici
lokman alici el 6 de Jun. de 2020
lokman alici
lokman alici el 6 de Jun. de 2020
Thank you for your interest. I load the subsystem and all of my model.
Walter Roberson
Walter Roberson el 6 de Jun. de 2020
you appear to be using a Math Block for the expression, not a MATLAB Function Block. Math blocks are much more restricted in what they permit.
lokman alici
lokman alici el 6 de Jun. de 2020
Hi;
when I am using the Mtlab Function. I get a error like that:
Simulink cannot determine sizes and/or types of the outputs for block 'omnirobotcontrol/Subsystem/MATLAB Function2' due to errors in the block body, or limitations of the underlying analysis. The errors might be inaccurate. Fix the indicated errors, or explicitly specify sizes and/or types for all block outputs.
Ameer Hamza
Ameer Hamza el 7 de Jun. de 2020
Can you show the code inside the MATLAB function block?
function x_2dot = fcn(u)
J = 0.01;
B = 0.1;
K = 0.01;
R = 1;
L = 0.5;
a=1;
m=1;
x_2dot=(-3*B*u(4))/(2*m)-((a*sin(u(5))*u(1))/m)-((a*sin((pi/3)-u(5))*u(2))/m)+((a*sin((pi/3)+u(5))*u(3))/m);
end

Iniciar sesión para comentar.

 Respuesta aceptada

Ameer Hamza
Ameer Hamza el 7 de Jun. de 2020
Try this
function x_2dot = fcn(u)
x_2dot = 0; % initialize to tell simulink about its size
J = 0.01;
B = 0.1;
K = 0.01;
R = 1;
L = 0.5;
a=1;
m=1;
x_2dot=(-3*B*u(4))/(2*m)-((a*sin(u(5))*u(1))/m)-((a*sin((pi/3)-u(5))*u(2))/m)+((a*sin((pi/3)+u(5))*u(3))/m);
end

Más respuestas (0)

Categorías

Productos

Preguntada:

el 6 de Jun. de 2020

Comentada:

el 7 de Jun. de 2020

Community Treasure Hunt

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

Start Hunting!

Translated by