Why I am getting the error message:Assignment has more non-singleton rhs dimensions than non-singleton subscripts

1 次查看(过去 30 天)
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

采纳的回答

Dennis
Dennis 2018-7-9
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

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 MATLAB 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by