Signal dimension in Simulink change when fed back in closed loop
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Amal Elawad
el 13 de Mzo. de 2016
Respondida: Vineeth Kartha
el 17 de Mzo. de 2016
I have a Simulink model. I used MATLAB user defined functions to build my model. The signal propagating in the system are either 3x3 matrix or a 3x1 column vector. I am building a controller. Everything works perfectly fine when I am using an open loop connection. However, as soon as I close the loop the dimensions get missed up, and every 3x1 vector - which is supposed to be fed back- turns into a scalar value. So, whenever I try to extract it's content within any of my user-defined functions I get this error: "Index expression out of bounds. Attempted to access element 2. The valid range is 1-1." So I am getting a scalar instead of a vector. In the attached image: each of q, qdot and qdotdot is a 3x1 column vector. How can I solve this??
<<
>>
0 comentarios
Respuesta aceptada
Vineeth Kartha
el 17 de Mzo. de 2016
Hi,
Sometimes Simulink is unable to determine the size of signals without additional specification. This is especially the case with MATLAB function blocks since the code written inside this block under goes code generation. The conversion of C-code requires signal dimensionality to be known in advance prior to code generation.
The solution to this is to make use of signal specification blocks to define the size of signals prior to inputting them back into MATLAB function blocks.
Hope this helps
Regards
Vineeth
0 comentarios
Más respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!