필터 지우기
필터 지우기

Signal dimension in Simulink change when fed back in closed loop

조회 수: 1 (최근 30일)
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??
<<
>>

채택된 답변

Vineeth Kartha
Vineeth Kartha 2016년 3월 17일
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개)

카테고리

Help CenterFile Exchange에서 Classical Control Design에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by