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

조회 수: 2 (최근 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에서 Calculus에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by