Metodos Numericos

Páginas: 3 (608 palabras) Publicado: 30 de junio de 2012
Redlich kwong Método bisección :
disp('Ecuacion de Redlich-kwong 2');
a=input('Ingrese a: ');
b=input('Ingrese b: ');
T=input('Ingrese T(K): ');
P=input('Ingrese P(bar): ');R=input('Ingrese R(cm^3.bar/K.mol): ');
syms x
f=R*T/(x-b)-a/((sqrt(T))*x*(x+b))-P;
x0=(R*T)/(P);
disp('Primer punto inicial: ');
disp(x0);
xai=x0;
xbi=input('Ingrese Limite Superior: ');tol=input('Ingrese Tolerancia: ');
f=inline(f);
i=1;
ea(1)=100;
if f(xai)*f(xbi) < 0
xa(1)=xai;
xb(1)=xbi;
f1=f(xai);
xr(1)=(xa(1)+xb(1))/2;
fprintf('Iter. V1 F1 V2 Erroraprox \n');
fprintf('%2d \t %11.7f \t %11.7f \t %11.7f \n',i,xa(i),f1(i),xr(i));
while abs(ea(i)) >= tol,
if f(xa(i))*f(xr(i))< 0
xa(i+1)=xa(i);
xb(i+1)=xr(i);
end
if f(xa(i))*f(xr(i))>0
xa(i+1)=xr(i);
xb(i+1)=xb(i);
end
xr(i+1)=(xa(i+1)+xb(i+1))/2;
ea(i+1)=abs((xr(i+1)-xr(i))/(xr(i+1))*100);
fprintf('%2d \t %11.7f \t %11.7f \t %11.7f \t %7.3f \n',...i+1,xa(i+1),xr(i+1),xb(i+1),ea(i+1));
i=i+1;
end
else
fprintf('No existe una raíz en este intervalo');
end

Newton Rapshon van der walls
disp ('Ecuacion de Van der Walls')
T=input('Ingrese T(K): ');P=input('Ingrese P(bar): ');
R=input('Ingrese R(L.bar/K.mol): ');
a=input('Ingrese a(bar.L^2/mol^2):');
b=input('Ingrese b(l/mol):');
disp('Volumen Inicial: ');
xo=R*T/P;
disp(xo);
n=input ('Numero deIteraciones=');
salida=ones(n,3); % matiz de salida de datos
for i=1:n
x1=xo-(P*xo^3+(-P*b-R*T)*xo^2+a*xo-a*b)/(3*P*xo^2+2*(-P*b-R*T)*xo+a);
vsal=[xo;x1];
ea=abs((x1-xo)/x1); % error
xo=x1;salida(i,1)=i;
salida(i,2)=x1;
salida(i,3)=ea;
end
disp('Iter. V(i) Error');
disp(num2str(salida));

Vander walls bisección

disp('Ecuacion de Vander walls');
a=input('Ingrese a: ');b=input('Ingrese b: ');
T=input('Ingrese T(K): ');
P=input('Ingrese P(bar): ');
R=input('Ingrese R(cm^3.bar/K.mol): ');
syms x
f=(P+a/x^2)*(x-b)-R*T;
x0=(R*T)/(P);
disp('Primer punto...
Leer documento completo

Regístrate para leer el documento completo.

Estos documentos también te pueden resultar útiles

  • Metodos numericos
  • Métodos Numéricos
  • Metodos numericos
  • Metodos numericos
  • Metodos numericos
  • Metodos Numericos
  • Metodos Numericos
  • metodos numericos

Conviértase en miembro formal de Buenas Tareas

INSCRÍBETE - ES GRATIS