필터 지우기
필터 지우기

Size mismatch in matrix multiplications

조회 수: 1 (최근 30일)
chuyen hoangcao
chuyen hoangcao 2020년 10월 25일
댓글: chuyen hoangcao 2020년 10월 25일
I had some error in my Matlab function block but i can not solve ,please help me.
function Tl = fcn(e,s,t,Cl,gl)
lamda = 0.6; kt = 8; p = 0.8;ep=3;d=1.2;
w0 = 0.2+0.3*sin(15*t);
theta = [0.99; 0.12; 0.28; 1.02; 0.20];
theta0 = [0.56; 0.23; 0.19; 0.97; 0.18];
%Matrices of dynamic equation.
Ce = Cl/(1+0.2*sin(3*t));
ge = gl/(1+0.1*sin(4*t));
Yl = (Ce*lamda*e+ge)/theta;
% dieu kien theta
if norm(transpose(Yl).*s)> ep
Rotheta = -p*(transpose(Yl).*s/norm(transpose(Yl)*s));
else
Rotheta = -p*transpose(Yl).*s/ep;
end
% dieu kien cua w estimation
if norm(s) > ep
Row = d*s/norm(s);
else
Row = d*s/ep;
end
thetae = theta0 + Rotheta;
we = w0 + Row;
Tl = Yl*thetae - kt*s +we;
Errors: Size mismatch (size [5 x 1] ~= size [2 x 1]).
Function 'Robust Controller/Controller' (#74.318.334), line 15, column 9:
"transpose(Yl).*s"
Undefined function or variable 'Rotheta'. The first assignment to a local variable determines its class.
Function 'Robust Controller/Controller' (#74.562.569), line 27, column 19:
"Rotheta".
  댓글 수: 5
dpb
dpb 2020년 10월 25일
Well, now you have an orientation problem of a column vector and row vector. Again, matrix operations must follow rules for matrix algebra in having consistent dimensions for the respective operation.
We still don't know anything about the problem to be able to tell you which should be the transposed operation; you're the only one who knows the linear algebra behind what you're trying to code.
chuyen hoangcao
chuyen hoangcao 2020년 10월 25일
can you help me glance at my simulation ? I just coded based on the number of paper and its structure.

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Simulink에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by