How can I change this loop so that it has no errors?
Show older comments
syms e1 e2
digits(4)
for i=1:99
x(i)=0.1*(99-i);
j(i)=0.1*i;
Yco=(e1-e2)/(10+2*e1);
Yh2=(3*e1+e2)/(10+2*e1);
Yh2o(i)=(x(i)-e1-e2)/(10-2*e1);
Yco2=e2/(10+2*e1);
Ych4(i)=(j(i)-e1)/(10+2*e1);
K1(i)=(Yco*((Yh2)^3))/(Ych4(i)*Yh2o(i))==1.93*10^-4;
K2(i)=(Yco2*Yh2)/(Yco*Yh2o(i))==5.528;
Z(i)=vpasolve([K1(i),K2(i)],[e1,e2],[0 1; 0 1],'Random',true);
E1(i)=Z(i).e1;
E2(i)=Z(i).e2;
Yh2new(i)=(3.*E1(i)+E2(i)./(10+2.*E1(i)));
end
Accepted Answer
More Answers (0)
Categories
Find more on Common Operations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!