Documentos de Académico
Documentos de Profesional
Documentos de Cultura
Ecuaciones a utilizar:
Diagrama de Flujo
Inicio
A
C,v3,z,error Si No
Error<=tol
N=50 Si no
Tol=0.0001 v3,z
c=0 f+c==N+1
v1=1000
v2=2500 v2=v3
break v1=v3
T=523.15
P=1800*0.01
R=83.14
a= R/T
Fin
c<=N
c=c+1
v3=(v1+v2)/2
error=abs((v3-v1)/v1)
z=v3/a
x(c)=c
y(c)= error
u(c)=v3
k(c)=z
A
Codificado del Programa
function villarroel_p3_corre
clc; clear all
N=50; tol= 0.0001; c=0;
v1=1000; v2=2500;
T=523.15; P=1800*0.01; R=83,14;
a=(R*T)/P
disp('N` Vol Mol Fact.Compr Error')
while c<=N
c=c+1;
v3=((v1+v2)/2);
error= abs((v3-v1)/v1);
z=v3/a;
x(c)=c;
y(c)= error;
u(c)=v3;
k(c)=z;
fprintf('%2.2f %2.3f %1.2f %1.3f\n',c, v3,z,error)
if error<= tol
fprintf('El vol molar es v=%1.3f\n',v3)
fprintf('El Factor de Compr. es z=%1.3f\n',z)
break
else if f(v3)*f(v1)<=0
v2=v3;
else
v1=v3;
end
end
end
subplot(2,2,1), plot(x,y,'r'), grid on
xlabel('Iteraciones')
ylabel('Error')
title('Iteraciones vs Error')
subplot(2,2,2), plot(x,u,'b'), grid on
xlabel('Iteraciones')
ylabel('Vol Molar')
title('Iteraciones vs Vol Molar')
subplot(2,2,3), plot(x,c,'g'), grid on
xlabel('Iteraciones')
ylabel('Fact. de Compr.')
title('Iteraciones vs Fact de Compr.')
function m=f(v)
B=-125.5; C=-5800; T=523.15; P=1800*0.01; R=83.14;
a=(R*T)/P;
m=a*((1+B/v)+(C/(v^2))-v);