problem with signal dimension

조회 수: 4 (최근 30일)
manikya valli
manikya valli 2016년 3월 21일
댓글: manikya valli 2016년 3월 21일
Hi, I am getting 'index expression out of bounds' error when I compiling my simlink model. It is the problem with signal dimension. In my code q_v and w_bi are of 3x1 matrices but when I compiling simlink model (attached here), it is treating as scalars.Please help me how to specify signal dimension to q_v, w_bi in the following code and corresponding simulink model is attached.
function [q_v_dot, q4_dot,w_bi_dot] = sc_dyn(q_v,q4,w_bi,tau)
I=[0.0027 0 0;0 0.0107 0;0 0 0.0101];
w_bi_dot = inv(I)*(tau - Smtrx(w_bi)*(I*w_bi));
q_v_dot =(1/2)*(q4*eye(3)+Smtrx(q_v))*w_bi;
q4_dot = -(1/2)*q_v'*w_bi;
end
function S=Smtrx(i)
S = [0 -i(3) i(2);i(3) 0 -i(1);-i(2) i(1) 0];
end

답변 (1개)

Vaibhav Awale
Vaibhav Awale 2016년 3월 21일
Hi Manikya,
I do not find any attached model. However to resolve the dimension mismatch error, you can specify the dimensions of your inputs and outputs of MATLAB function block. To do this, you can open "Model Explorer" by pressing "Ctrl-H" or by navigating to "View->Model Explorer-> Model Explorer".
Inside Model Explorer, you can specify the dimension of signals used in MATLAB functions "sc_dyn" and "Smtrx" by navigating to the appropriate MATLAB function block and specifying "Size" of each signal.
I hope this helps.
Regards,
Vaibhav
  댓글 수: 1
manikya valli
manikya valli 2016년 3월 21일
Thank you very much. Problem solved

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Two y-axis에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by