Why I am getting the error message:Assignment has more non-singleton rhs dimensions than non-singleton subscripts
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Sandra Maria Cherian
le 9 Juil 2018
Commenté : Sandra Maria Cherian
le 9 Juil 2018
syms tmv; tdcvv=[ 1.7691180562790619335090624118428, 3.7203521516231003235052331604841, 4.2549397326879975357442412372052; 1.8728284259647972559033795104949, 4.0675421128150192508477208506903, 5.0616967785172204893339442877428; 2.1175654748328456634231199033899, 3.1758086461927840904807328442577, 3.7653737399696897254758169563108]; S=40; C=60; a0=1.993; a1=0.002; a2=0.015; b0=38.086; b1=-0.176; b2=-0.633; c0=10.720; c1=1.256; c2=1.522; a=a0+a1.*S+a2.*C; b=b0+b1.*S+b2.*C; c=c0+c1.*S+c2.*C; eqs=a+b.*tmv+c.*tmv.^2; teqs=eqs==tdcvv; teqsd=vpa(teqs); tmvVV=sym('tmvVV',[3 3]); tic for i=1:3 for j=1:3 tmvVV(i,j)=vpasolve(teqsd(i,j),tmv); end end
0 commentaires
Réponse acceptée
Dennis
le 9 Juil 2018
tmvVV(i,j)=vpasolve(teqsd(i,j),tmv);
This line returns 2 values, but tmvVV(i,j) has only 1 field. Adding a third dimension tmvVV(i,j,:) or using cells should fix your problem.
syms tmv;
tdcvv=[ 1.7691180562790619335090624118428, 3.7203521516231003235052331604841, 4.2549397326879975357442412372052; 1.8728284259647972559033795104949, 4.0675421128150192508477208506903, 5.0616967785172204893339442877428; 2.1175654748328456634231199033899, 3.1758086461927840904807328442577, 3.7653737399696897254758169563108];
S=40; C=60; a0=1.993; a1=0.002; a2=0.015; b0=38.086; b1=-0.176; b2=-0.633; c0=10.720; c1=1.256; c2=1.522; a=a0+a1.*S+a2.*C; b=b0+b1.*S+b2.*C; c=c0+c1.*S+c2.*C; eqs=a+b.*tmv+c.*tmv.^2; teqs=eqs==tdcvv;
teqsd=vpa(teqs);
tmvVV=sym('tmvVV',[3 3 2]);
for i=1:3
for j=1:3
tmvVV(i,j,:)=vpasolve(teqsd(i,j),tmv);
end
end
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Calculus 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!