Retrieving Iteration Results in Matlab - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Retrieving Iteration Results in Matlab

adeeyoadeeyo Posts: 1Member
Dear All,
I need to retrieve the value for Z, Za, V, Va for all the iterations of the code below. Please how do I do it?

z=[0.2 0.2 0.2 0.4]; W_PR=0.245; C=4;
omega=[0.344 0.467 0.578 0.789];
Tc=[600 700 500 570]; Pc=[50 70 58 76]; R=8.314; P=20;

K_PR=[1.546e-2, 0.456, 1.432e2, 14.32]; iter = 0;

for k=40:10:80
T(k)=273.15+k;
for c=1:C
x_PR(1,c)=z(c)/(1+W_PR*(K_PR(c)-1));
x_PR(2,c)=K_PR(c)*x_PR(1,c);
kappa_PR=0.37464+1.54226.*omega(c)-0.26992.*omega(c).^2;
alpha_PR=(1+kappa_PR.*(1-sqrt(T(k)./Tc(c)))).^2;
a_PR(c,c)=0.45724.*R.^2.*Tc(c).^2./Pc(c).*alpha_PR;
b_PR(c)=0.07780*R.*Tc(c)./Pc(c);
end
for c=2:C
for n=1:(c-1)
a_PR(c,n)=sqrt(a_PR(c,c).*a_PR(n,n));
a_PR(n,c)=a_PR(c,n);
end
end
for c=1:C
A_PR(c,c)=a_PR(c,c).*P./(R.*T(k)).^2;
B_PR(c)=b_PR(c).*P./(R.*T(k));
Z(c,c)=A_PR(c,c)./5; V(c)=B_PR(c).*6;
end
for c=1:C
Aa_PR(c,c)=a_PR(c,c).*P./(R.*T(k)).^3;
Ba_PR(c)=b_PR(c).*P./(R.*T(k));
Za(c,c)=A_PR(c,c)./8; Va(c)=B_PR(c).*9;
end

end

Thanks
adeeyo
Sign In or Register to comment.