Mejoras del metodo de Euler

Páginas: 2 (484 palabras) Publicado: 17 de mayo de 2015
Mejoras del método de Euler
Método de heun
1 Creamos una aplicación
function f
fprintf('\n \tRESOLUCION DE ECUACIONES DIFERENCIALES POR METODO DE HEUN \n')
f=input('\n Ingrese la ecuaciondiferencial dy/dx=\n','s');
x0=input('\n Ingrese el primer punto x0:\n');
x1=input('\n Ingrese el segundo punto x1:\n');
y0=input('\n Ingrese la condicion inicial y(x0):\n');
n=input('\n Ingrese el numero depasos n:\n');
h=(x1-x0)/n;
xs=x0:h:x1;
y=y0+xs;
R=zeros(n,n);
fprintf('\n''it x0 y(x1)');
for i=1:n
it=i-1;
x0=xs(i);
x=x0;
y=y0;
k1=eval(f);
p=h;
x=xs(i+1);
y=y0+h*k1;
k2=eval(f);
y0=y0+h*(k1+k2)/2;fprintf('\n%2.0f%10.6f%10.6f\n',it+1,x0+h,y0);
end
fprintf('\n El punto aproximado y(x1) es = %8.6f\n',y0);

2 Lo guardamos como metodoheun y llenamos los siguientes valores
>> metodoheun

RESOLUCIONDE ECUACIONES DIFERENCIALES POR METODO DE HEUN

Ingrese la ecuacion diferencial dy/dx=
4*exp(0.8*x)-0.5*y
Ingrese el primer punto x0:
0
Ingrese el segundo punto x1:
2
Ingrese la condicioninicial y(x0):
0
Ingrese el numero de pasos n:
10
'it x0 y(x1)
1 0.200000 0.829404
2 0.400000 1.723926
3 0.600000 2.702349
4 0.800000 3.786005
5 1.000000 4.999284
6 1.2000006.370225
7 1.400000 7.931206
8 1.600000 9.719745
9 1.800000 11.779438
10 2.000000 14.161055
El punto aproximado y(x1) es = 14.161055

Metodo de punto medio
1
function f
fprintf('\n\tRESOLUCION DE ECUACIONES DIFERENCIALES POR POR PUNTO MEDIO \n')
f=input('\n Ingrese la ecuacion diferencial dy/dx=\n','s');
x0=input('\n Ingrese el primer punto x0:\n');
x1=input('\n Ingrese el segundo puntox1:\n');
y0=input('\n Ingrese la condicion inicial y(x0):\n');
n=input('\n Ingrese el numero de pasos n:\n');
h=(x1-x0)/n;
xs=x0:h:x1;
fprintf('\n''it x0 y(x1)');
for i=1:n
it=i-1;
x0=xs(i);
x=x0;y=y0;
k1=h*eval(f);
x=xs(i+1);
y=y0+k1;
k2=h*eval(f);
y0=y0+(k1+k2)/2;
fprintf('\n%2.0f%10.6f%10.6f\n',it,x0,y0);
end
fprintf('\n El punto aproximado y(x1) es = %8.6f\n',y0);
2 Lo guardamos como...
Leer documento completo

Regístrate para leer el documento completo.

Estos documentos también te pueden resultar útiles

  • Ejemplos metodo euler mejorado
  • Método de euler, euler mejorado y runge-kutta
  • Metodo De Euler Mejorado
  • Método De Euler Mejorado
  • Metodo de euler mejorado
  • Metodo De Euler Y Euler Gauss
  • Metodo De Euler
  • Método De Euler

Conviértase en miembro formal de Buenas Tareas

INSCRÍBETE - ES GRATIS