Effacer les filtres
Effacer les filtres

Size mismatch in matrix multiplications

1 vue (au cours des 30 derniers jours)
chuyen hoangcao
chuyen hoangcao le 25 Oct 2020
Commenté : chuyen hoangcao le 25 Oct 2020
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 commentaires
dpb
dpb le 25 Oct 2020
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 le 25 Oct 2020
can you help me glance at my simulation ? I just coded based on the number of paper and its structure.

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Simulink dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by