Why I am getting the error message:Assignment has more non-singleton rhs dimensions than non-singleton subscripts
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Sandra Maria Cherian
am 9 Jul. 2018
Kommentiert: Sandra Maria Cherian
am 9 Jul. 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 Kommentare
Akzeptierte Antwort
Dennis
am 9 Jul. 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
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Numbers and Precision finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!