Borrar filtros
Borrar filtros

Syntax error in Simulink

5 visualizaciones (últimos 30 días)
Nibash
Nibash el 8 de Nov. de 2022
Respondida: Geetla Sindhu el 11 de Nov. de 2022
I am getting a syntax error in Simulink in a Fcn block:
c1*(c2/u[2]-c3*u[3]-c4)*exp(-c5/u[2])+c6*u[1]

Respuestas (1)

Geetla Sindhu
Geetla Sindhu el 11 de Nov. de 2022
Hello Nibash,
I understand that you are getting syntax error while using MATLAB function block in Simulink.
The cause of this error is the use of square brackets [ ] for indexing the input vector. Instead, you can try using the following syntax to solve the issue.
function y = fcn(u)
y = c1*(c2/u(2) c3*u(3) c4)*exp(-c5/u(2)) + c6*u(1);
end
Hope this resolves your issue.
Thank you.

Categorías

Más información sobre Equations en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by