CAT arguments dimensions are not consistent using mldivide
13 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
My code is
for i=1:100;
dt=2;
A=[e11(1,1) e12(1,1) 0 0;
e21(1,1) e22(1,1) 0 0;
0 e32(1,1) e33(1,1) 0;
0 e42(1,1) e43(1,1) e44(1,1)];
B=[((qf-qs)*dt)+(e11(1,1)*Vwt(1,i))+(e12(1,1)*p(1,i));
((Q+qf*hf-qs*hs(1,i))*dt)+(e21(1,1)*Vwt(1,i))+(e22(1,1)*p(1,i));
((Q-ar(1,1)*hc(1,1)*qdc(1,1))*dt)+(e32(1,1)*p(1,i))+(e33(1,1)*ar(1,i));
((Ps*(Vsd0-Vsd(1,1))*dt)/Td)+(((hf-hw(1,1))*qf*dt)/hc(1,1))+(e42(1,1)*p(1,i))+(e43(1,1)*ar(1,i))+(e44(1,1)*Vsd(1,i))];
x=mldivide(A,B);
Vwt(1,i+1)=x(1,1);
p(1,i+1)=x(2,1);
ar(1,i+1)=x(3,1);
Vsd(1,i+1)=x(4,1);
Vst(1,i+1)=Vt-Vwt(1,i+1);
end
The error shown is
??? Error using ==> vertcat
CAT arguments dimensions are not consistent.
Error in ==> boiler at 124 B=[((qf-qs)*dt)+(e11(1,1)*Vwt(1,i))+(e12(1,1)*p(1,i)); Please help
0 commentaires
Réponse acceptée
per isakson
le 14 Mar 2014
Modifié(e) : per isakson
le 14 Mar 2014
Without values of e12, e21, e22, etc. we cannot find out why this error is thrown.
Here are some links on debugging in Matlab
.
Add the following lines before B=[((qf- ...
disp( size((qf-qs)*dt)+(e11(1,1)*Vwt(1,i))+(e12(1,1)*p(1,i)));
disp( size((Q+qf*hf-qs*hs(1,i))*dt)+(e21(1,1)*Vwt(1,i))+(e22(1,1)*p(1,i)));
disp( size((Q-ar(1,1)*hc(1,1)*qdc(1,1))*dt)+(e32(1,1)*p(1,i))+(e33(1,1)*ar(1,i)));
disp( size((Ps*(Vsd0-Vsd(1,1))*dt)/Td)+(((hf-hw(1,1))*qf*dt)/hc(1,1))+(e42(1,1)*p(1,i))+(e43(1,1)*ar(1,i))+(e44(1,1)*Vsd(1,i)));
5 commentaires
per isakson
le 14 Mar 2014
It is possible to attach files. Please use it next time.
I added the four lines disp(size( .. as I propose in the answer above. There was cut&paste errors, which I have fixed. And I put the code in a function, cssm1.
All the four expressions, which you try to concatenate vertically, B=[((qf ... return values of different size.
Running cssm1 on R2013a returned
>> cssm1
1.0e+04 *
3.1353 3.1353
1.0e+04 *
2.2456 2.2456
1 1
1 100
Error using vertcat
Dimensions of matrices being concatenated are not consistent.
Error in cssm1 (line 131)
B=[((qf-qs)*dt)+(e11(1,i)*Vwt(1,i))+(e12(1,i)*p(1,i));
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Sources dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!