How to output a vector in MATLAB Function in Simulink?

7 visualizaciones (últimos 30 días)
Gaetano Trovato
Gaetano Trovato el 23 de Oct. de 2022
Comentada: Gaetano Trovato el 24 de Oct. de 2022
I tried to do it this way, but it does not work. How can I fix it?
  2 comentarios
Paul
Paul el 23 de Oct. de 2022
Hi Gaetano,
What doesn't work?
As far as I can tell, that code takes in the state variables and outputs their derivatives, which are presumably integrated outside the function.
Also, there is no need to compute Minv explicitly. Instead, that last line could be
[xdot_3,xdot_4] = M_theta \ [same stuff here];
Gaetano Trovato
Gaetano Trovato el 23 de Oct. de 2022
Hi Paul,
Thank you for your reply.
It gives me this error, I cannot understand why.

Iniciar sesión para comentar.

Respuestas (1)

Paul
Paul el 23 de Oct. de 2022
One problem that I should have seen before is that this line
[xdot_3,xdot_4] = Minv * [same stuff here];
should be
temp = M_theta \ [same stuff here];
xdot_3 = temp(1);
xdot_4 = temp(2);
Does that solve all of the problems?

Categorías

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

Productos


Versión

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by