Error in sym / privsubsasgn and sym / subsasgn

6 次查看(过去 30 天)
Hi.
My code is as follows:
t=850
R=10000
xA=0:.01:.99;
xB=1-xA
gIdeal=8.314*t*(xA.*log(xA)+xB.*log(xB));
gA=(-11276.24+(253.048446*t)-38.5844296*t*log(t)+0.018531982*t^(2)-5.764227*10.^(-6)*t^(3)+74092*t^(-1))
gB=(-8162.609+(137.236859*t)-22.8317533*t*log(t)-0.001912904*t^(2)-3.552*10.^(-9)*t^(3)+176667*t^(-1))
gStndrd=xA.*gA+xB.*gB;
gExcess=xA.*xB.*(113246.16-58.0001*t);
gBulk=gIdeal+gStndrd+gExcess
va=(9.78122*10^(-6)+6.745*10^(-10)*t+1.91*10^(-16)*t^(3)+3.76*10^(-6)/t)
vb=(11.99189*10^(-6)+1.485*10^(-10)*t+7.0*10^(-15)*t^(2)+7.84*10^(-6)/t-380*10^(-6)/t^(2))
VAb=va*xA+vb*xB
HAL=0.286;
HSI=0.2;
sigmaAL=0.914*(1-0.725*0.286/R);
AReaAl=1.091*(6.022*10^(23))^(1/3)*va^(2/3);
SIgmaSi=0.773*(1-0.725*0.2/R);
AReaSi=1.091*(6.022*10^(23))^(1/3)*vb^(2/3);
pal=xB.^(2).*(-3143.78+0.39297.*t)+8.314.*t.*log(xA);
psi=xA.^(2).*(113246.16-58.0001.*t)+8.314.*t.*log(xB);
psurfal=0.84*pal;
psurfsi=0.84*psi;
Pspl=psurfal-pal;
Pspi=psurfsi-psi;
syms x
a1=sigmaAL;
a2=SIgmaSi;
a3=8.314;
a4=t;
a5=0:.01:.99
a6=Pspl
a7=Pspi
a8=AReaAl
a9=AReaSi
for i=2:100
pp=a1+(1/a8)*(a6(i))+((a3*a4)/(a8))*log(x/a5(i))
qq=a2+(1/a9)*(a7(i))+((a3*a4)/(a9))*log((1-x)/(1-a5(i)))
rr=qq-pp
hh(i)=solve(rr,x)
end
a1=sigmaAL;
a2=8.314;
a3=t;
a4=AReaAl;
a5=0:.01:.99
doublea6=double(hh(i));
a6=doublea6;
a7=Pspl;
for i=2:100
ss(i)=a1+((a2*a3)/a4)*log(a6(i)/a5(i))+(1/a4)*a7(i)
end
ss=real(ss(i))
doublea1=double(VAb);
a1=doublea1;
doublea2=double(ss);
a2=doublea2;
a3=R*10^(-9);
for i=2:100
tt(i)=(a1(i)*a2(i))/a3;
end
tt=real(tt(i))
doublea1=double(gBulk);
a1=doublea1;
doublea2=double(tt(i));
a2=doublea2;
for i=2:100
L(i)=a1(i)+a2(i);
end
L=real(L(i))
plot(L(i),xB)
My code has the following error:
In an assignment A(:) = B, the number of elements in A and B must be the same.
Error in sym/privsubsasgn (line 1031)
L_tilde2 = builtin('subsasgn',L_tilde,struct('type','()','subs',{varargin}),R_tilde);
Error in sym/subsasgn (line 868)
C = privsubsasgn(L,R,inds{:});
Error in dimntotal10nm (line 40)
hh(i)=solve(rr,x)
  1 个评论
sterling lin
sterling lin 2022-4-13
Have you solved this problem? I meet the same issue. Could you teach me how to solve that?

请先登录,再进行评论。

回答(0 个)

类别

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

Community Treasure Hunt

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

Start Hunting!

Translated by