Documentos de Académico
Documentos de Profesional
Documentos de Cultura
HUAMANGA
FACULTAD DE INGENIERIA DE MINAS GEOLOGIA Y CIVIL
PROFESIONAL
ESCUELA DE FORMACION
INGENIERIA CIVIL
ASIGNATURA: METODOS
NUMERICOS
(IC-343)
Profesor
ING. CRISTIAN CASTRO PEREZ
SOLUCION DE ECUACIONES DIFERENCIALES
ORDINARIASPROGRAMAS EN MATHLAB
GRUPO:GAUSS-SEIDEL
INTEGRANTES
CODIGO
ARAUJO MORALES, Yover
16071603
BELLIDO VALLEJO, Jhonatan Teodoro 16115683
CUADROS MUNAYLLA, Freddy
16950081
GIL GUILLEN, Ruben Daro
16842004
IRCANAUPA
HUARCAYA, Wilmer
16071605
AYACUCHO 2015
DEDICATORIA
A todos los que con su esfuerzo hacen de este mundo, un mundo mas feliz
mas comprensivo y armonioso.
A los ingenieros que conducen con su esfuerzo y dedicacion nuestra
formacion profesional.
iii
Indice general
1. FUNDAMENTO TEORICO
1.1. ECUACIONES DIFERENCIALES ORDINARIAS . . . . . .
iv
1
1
1
2
3
3
7
10
13
17
17
17
18
22
22
46
73
99
104
107
114
UNSCH
3. CONCLUSIONES
116
4. BIBLIOGRAFIA
117
LATEX
Ingeniera Civil
INTRODUCCION
MATLAB (laboratorio de matrices) es un software matematico muy versatil
que presenta un entorno interactivo y un lenguaje de programacion para
calculos cientficos y tecnicos que permite realizar calculos numericos, analisis de datos y graficos. Estas caractersticas hacen que MATLAB sea muy
usado en la implementacion de metodos numericos.
Hay dos entornos basicos en MATLAB, un entorno interactivo y un entorno de programacion mediante el uso del editor medit.
vi
Captulo 1
FUNDAMENTO TEORICO
1.1.
1.2.
FUNDAMENTOS MATEMATICOS
Una solucion de una EDO es una funcion especfica de la variable independiente y de sus parametros que satisfacen la Ecuacion Diferencial Original.
Para ilustrar este concepto, se tiene la siguiente funcion:
y = 0,5x4 + 4x3 10x2 + 8,5x + 1
El cual es un polinomio de cuarto orden.
Si se deriva la Ecuacion, se obtiene la EDO:
UNSCH
dy
= 2x3 + 12x2 20x + 8,5
(1.1)
dx
En vez de representar explcitamente los valores de y para cada uno de los
valores de x, la ecuacion (a) proporciona la relacion del cambio de y respecto
a x (esto es, la pendiente) para cada valor de x.
Se puede determinar la solucion en forma analtica integrandola ecuacion
(a):
Z
y=
un du =
un+1
+c
n+1
1.3.
DE UNA ECUACION
DISOLUCION
FERENCIAL
f x, y, y 0 , y 00 , . . . , y (n) = 0, . . . (1)
Se establece en matematicas que en su solucion general deben aparecer n
constantes arbitrarias. Entonces, puede aceptarse que la solucion general de
(1) es:
g (x, y, c1, c2, . . . , cn) = 0, . . . (2)
Se distinguen dos tipos de problemas: los llamados de Valores Iniciales y los
de Valores en la Frontera.
LATEX
Ingeniera Civil
UNSCH
Un problema de valores iniciales esta gobernado por una ecuacion diferencial de orden n y un conjunto de n condiciones independientes todas ellas,
validas para el mismo punto inicial. Si la ecuacion (1) es la ecuacion diferencial que define el problema, y X = a es el punto inicial, puede aceptarse que
la n condiciones independientes son:
Y (a) = (Y 0, Y 0 (a) = Y 0 0, Y 00 0, . . . , Y (n) (a) = Y 0(n)
(1.2)
Por el contrario, en los problemas de valores en la frontera deben establecerse condiciones de frontera en todos y cada uno de los puntos que
constituyen la frontera del dominio de soluciones del problema. En particular en el espacio de una dimension, hay dos puntos frontera, por ejemplo, X
= a y X = b, si el dominio de soluciones es el intervalo cerrado
Basicamente la solucion numerica de ecuaciones diferenciales consiste en
sustituir el dominio continuo de soluciones por uno discreto formado por
puntos aislados igualmente espaciados entre s.
As, en un problema de valores iniciales, el dominio de definicion de soluciones se sustituye por el conjunto infinito numerable de puntos,
X0 = a, X1 = X0 + h, X2 = X0 + 2h, X3 = X0 + 3h, ...
y en el caso de valores en la frontera se sustituye el intervalo por el conjunto
finito de puntos
X0 = a, X1 = X0 + h, X2 = X0 + 2h, ..., Xn = X0 + nh = b
Obtenidos, al dividir el intervalo en n partes iguales.
1.4.
1.4.1.
Ingeniera Civil
UNSCH
Euler (a,b,N,a)
h<(ba)/n
t0<a
y0< a
Para i desde 1 hasta N hacer
ti<a+i*h
yi?yi1+h*f(ti1,yi1)
Fin para
Mostrar (t0, y0),( t1 ,y1),...( tN, YN)
FIN
CODIGO EN MATLAB
LATEX
Ingeniera Civil
UNSCH
u{1,1}=' y';
u{2,1}=sprintf(' %8.6f',U(1));
for i=1:N
LATEX
Ingeniera Civil
UNSCH
n{i+2,1}=sprintf(' %4d',i);
U(i+1)=U(i)+(1/2)*(h*f(t(i),U(i))+h*f(t(i)+h,U(i)+h*f(t(i),U(i))));
u{i+2,1}=sprintf(' %8.6f',U(i+1));
t(i+1)=a+(i*h);
p{i+2,1}=sprintf(' %4.2f',t(i+1));
end
set(handles.lst x,'string',p)
set(handles.lst y,'string',u)
set(handles.list n,'string',n)
plot(handles.grafico,t,U,'r')
sol=['y(',num2str(t(end)),')=',num2str(U(end))];
set(handles.sol final,'string',sol)
guidata(hObject, handles);
axes(handles.grafico);
xlabel('Eje x')
ylabel('Eje y')
grid on;
function limpiar Callback(hObject, eventdata, handles)
set(handles.lee funcion,'string','')
set(handles.lee intervalo,'string','')
set(handles.lee tpaso,'string','')
set(handles.lee ci,'string','')
set(handles.lst x,'string','')
set(handles.lst y,'string','')
set(handles.sol final,'string','')
set(handles.list n,'string','')
axes(handles.grafico);
set(handles.ejecutar,'enable','off')
plot(0,0)
function prueba Callback(hObject, eventdata, handles)
global condicion
k=get(handles.d1,'string');
set(handles.lee funcion,'string',k);
k=get(handles.d2,'string');
set(handles.lee intervalo,'string',k);
k=get(handles.d3,'string');
set(handles.lee tpaso,'string',k)
k=get(handles.d4,'string');
set(handles.lee ci,'string',k)
set(handles.ejecutar,'enable','on')
condicion=1;
function lst x Callback(hObject, eventdata, handles)
function lst y Callback(hObject, eventdata, handles)
function sol final Callback(hObject, eventdata, handles)
function list n Callback(hObject, eventdata, handles)
function escudo ButtonDownFcn(hObject, eventdata, handles)
function text17 ButtonDownFcn(hObject, eventdata, handles)
LATEX
Ingeniera Civil
UNSCH
1.4.2.
Paso
Paso
Paso
Paso
Paso
1. Hacer H=(XFX0)/N
2. Hacer X(0)=X0
3. Hacer Y(0)=Y0
4. Hacer J=1
5. Mientras J=3, repetir los pasos 6 a 9.
Paso 6. Realizar los pasos 4 a 9 del algoritmo 7.3
Paso 7. Hacer X(J)=X0
Paso 8. Hacer Y(0)=Y0
Paso 9. Hacer J=J+1
Paso 10. Hacer I=4
Paso 11. Mientras I=N, repetir los pasos 12 a 20
Paso 12. Hacer Y(4)=Y(3)+H/24*(F(X(3),Y(3))59*F(X(2),Y(2))+37*F(X(1),
Y(1))9*F(X(0),Y(0)))
Paso 13. Hacer X(4)=X(3)+H
Paso 14. Hacer Y(4)=Y(3)+H/24*(9*F(X(4),Y(4))+19*F(X(3),Y(3))5*F(X(2),
Y(2))+F(X(1),Y(1)))
Paso 15. Hacer J=0
Paso 16. Mientras J=3, repetir los pasos 17 a 19
Paso 17. Hacer X(J)=X(J+1)
Paso 18. Hacer Y(J)=Y(J+1)
Paso 19. Hacer J=J+1
Paso 20. Hacer I=I+1
Paso 21.IPRIMIR Y(4) Y TERMINAR
CODIGO EN MATLAB
LATEX
Ingeniera Civil
UNSCH
end
function predictor corrector por Yover1 OpeningFcn(hObject, eventdata,
handles, varargin)
set(handles.sol final,'enable','off')
set(handles.ejecutar,'enable','off')
global condicion
condicion=0;
a=imread('unsch.jpg');
axes(handles.escudo);
imshow(a);
handles.output = hObject;
guidata(hObject, handles);
function varargout = predictor corrector por Yover1 OutputFcn(hObject,
eventdata, handles)
varargout{1} = handles.output;
function lee funcion Callback(hObject, eventdata, handles)
fun=get(hObject,'String');
handles.fun=fun;
handles.output = hObject;
guidata(hObject, handles);
function lee intervalo Callback(hObject, eventdata, handles)
I=str2num(get(hObject,'String'));
handles.I=I;
handles.output = hObject;
guidata(hObject, handles);
function lee tpaso Callback(hObject, eventdata, handles)
h=str2double(get(hObject,'String'));
handles.h=h;
handles.output = hObject;
guidata(hObject, handles);
function lee ci Callback(hObject, eventdata, handles)
ci=str2double(get(hObject,'String'));
set(handles.ejecutar,'enable','on')
handles.ci=ci;
handles.output = hObject;
guidata(hObject, handles);
function ejecutar Callback(hObject, eventdata, handles)
global condicion
if condicion==1
fun=get(handles.lee funcion,'string');
I=str2num(get(handles.lee intervalo,'string'));
h=str2double(get(handles.lee tpaso,'string'));
U(1)=str2double(get(handles.lee ci,'string'));
else
fun=handles.fun;
I=handles.I;
h=handles.h;
U(1)=handles.ci;
end
LATEX
Ingeniera Civil
UNSCH
f=inline(fun,'x','y');
a=I(1);
b=I(2);
t(1)=a;
N=(ba)/h;
n{1,1}=' n';
n{2,1}=sprintf(' %4d',0);
p{1,1}=' x';
p{2,1}=sprintf(' %4.2f',t(1));
u{1,1}=' y';
u{2,1}=sprintf(' %8.6f',U(1));
for i=1:3
n{i+2,1}=sprintf(' %4d',i);
k1=h*f(t(i),U(i));
k2=h*f(t(i)+h/2,U(i)+1/2*k1);
k3=h*f(t(i)+h/2,U(i)+1/2*k2);
k4=h*f(t(i)+h,U(i)+k3);
U(i+1)=U(i)+1/6*(k1+2*k2+2*k3+k4);
u{i+2,1}=sprintf(' %8.6f',U(i+1));
t(i+1)=a+(i*h);
p{i+2,1}=sprintf(' %4.2f',t(i+1));
end
for i=4:N
n{i+2,1}=sprintf(' %4d',i);
w=U(i)+(h/24)*(55*f(t(i),U(i))59*f(t(i1),U(i1))+...
37*f(t(i2),U(i2))9*f(t(i3),U(i3)));
t(i+1)=a+(i*h);
U(i+1)=U(i)+(h/24)*(9*f(t(i+1),w)+19*f(t(i),U(i))...
5*f(t(i1),U(i1))+f(t(i2),U(i2)));
u{i+2,1}=sprintf(' %8.6f',U(i+1));
p{i+2,1}=sprintf(' %4.2f',t(i+1));
end
set(handles.lst x,'string',p)
set(handles.lst y,'string',u)
set(handles.list n,'string',n)
plot(handles.grafico,t,U,'r')
sol=['y(',num2str(t(end)),')=',num2str(U(end))];
set(handles.sol final,'string',sol)
guidata(hObject, handles);
axes(handles.grafico);
xlabel('Eje x')
ylabel('Eje y')
grid on;
function limpiar Callback(hObject, eventdata, handles)
set(handles.lee funcion,'string','')
set(handles.lee intervalo,'string','')
set(handles.lee tpaso,'string','')
set(handles.lee ci,'string','')
set(handles.lst x,'string','')
LATEX
Ingeniera Civil
UNSCH
set(handles.lst y,'string','')
set(handles.sol final,'string','')
set(handles.ejecutar,'enable','off')
set(handles.list n,'string','')
axes(handles.grafico);
plot(0,0)
function prueba Callback(hObject, eventdata, handles)
global condicion
k=get(handles.d1,'string');
set(handles.lee funcion,'string',k);
k=get(handles.d2,'string');
set(handles.lee intervalo,'string',k);
k=get(handles.d3,'string');
set(handles.lee tpaso,'string',k)
k=get(handles.d4,'string');
set(handles.lee ci,'string',k)
set(handles.ejecutar,'enable','on')
condicion=1;
function lst x Callback(hObject, eventdata, handles)
function lst y Callback(hObject, eventdata, handles)
function sol final Callback(hObject, eventdata, handles)
function list n Callback(hObject, eventdata, handles)
function escudo ButtonDownFcn(hObject, eventdata, handles)
function text17 ButtonDownFcn(hObject, eventdata, handles)
1.4.3.
Z m
bjkjn = 0, 1, . . . ., N 1
j=1
Donde ki (x, y) = f (x + ci h , y + h
Rm
j=1
CODIGO EN MATLAB
LATEX
10
Ingeniera Civil
UNSCH
LATEX
11
Ingeniera Civil
UNSCH
global condicion
if condicion==1
fun=get(handles.lee funcion,'string');
I=str2num(get(handles.lee intervalo,'string'));
h=str2double(get(handles.lee tpaso,'string'));
U(1)=str2double(get(handles.lee ci,'string'));
else
fun=handles.fun;
I=handles.I;
h=handles.h;
U(1)=handles.ci;
end
f=inline(fun,'x','y');
a=I(1);
b=I(2);
t(1)=a;
N=(ba)/h;
n{1,1}=' n';
n{2,1}=sprintf(' %4d',0);
p{1,1}=' x';
p{2,1}=sprintf(' %4.2f',t(1));
u{1,1}=' y';
u{2,1}=sprintf(' %8.6f',U(1));
for i=1:N
n{i+2,1}=sprintf(' %4d',i);
k1=h*f(t(i),U(i));
k2=h*f(t(i)+h/2,U(i)+1/2*k1);
k3=h*f(t(i)+h/2,U(i)+1/2*k2);
k4=h*f(t(i)+h,U(i)+k3);
U(i+1)=U(i)+1/6*(k1+2*k2+2*k3+k4);
u{i+2,1}=sprintf(' %8.6f',U(i+1));
t(i+1)=a+(i*h);
p{i+2,1}=sprintf(' %4.2f',t(i+1));
end
set(handles.lst x,'string',p)
set(handles.lst y,'string',u)
set(handles.list n,'string',n)
plot(handles.grafico,t,U,'r')
sol=['y(',num2str(t(end)),')=',num2str(U(end))];
set(handles.sol final,'string',sol)
guidata(hObject, handles);
axes(handles.grafico);
xlabel('Eje x')
ylabel('Eje y')
grid on;
function limpiar Callback(hObject, eventdata, handles)
set(handles.lee funcion,'string','')
set(handles.lee intervalo,'string','')
set(handles.lee tpaso,'string','')
LATEX
12
Ingeniera Civil
UNSCH
set(handles.lee ci,'string','')
set(handles.lst x,'string','')
set(handles.lst y,'string','')
set(handles.sol final,'string','')
set(handles.list n,'string','')
set(handles.ejecutar,'enable','off')
axes(handles.grafico);
plot(0,0)
function prueba Callback(hObject, eventdata, handles)
global condicion
k=get(handles.d1,'string');
set(handles.lee funcion,'string',k);
k=get(handles.d2,'string');
set(handles.lee intervalo,'string',k);
k=get(handles.d3,'string');
set(handles.lee tpaso,'string',k)
k=get(handles.d4,'string');
set(handles.lee ci,'string',k)
set(handles.ejecutar,'enable','on')
condicion=1;
function lst x Callback(hObject, eventdata, handles)
function lst y Callback(hObject, eventdata, handles)
function sol final Callback(hObject, eventdata, handles)
function list n Callback(hObject, eventdata, handles)
function text17 ButtonDownFcn(hObject, eventdata, handles)
function escudo ButtonDownFcn(hObject, eventdata, handles)
1.4.4.
METODO DE TAYLOR
13
Ingeniera Civil
UNSCH
dF 0 (x)
dx
df (x,y)
y,
dx
(x1 x0 )2
2!
h = x1 x0
h2 df (x, y)
x0 , y0
y1 = y0 + hf (x0 , y0 ) +
2!
dx
Entonces se sugiere considerar (5) para obtener y2, y3,..., yn mejorara la
exactitud obtenida con (1) consecuentemente se propone la formula:
yi+1
h2 df (x, y)
= yi + hf (x, y) +
xi , yi
2!
dx
CODIGO EN MATLAB
LATEX
14
Ingeniera Civil
UNSCH
if nargout
[varargout{1:nargout}] = gui mainfcn(gui State, varargin{:});
else
gui mainfcn(gui State, varargin{:});
end
function Taylor by Yover1 OpeningFcn(hObject, eventdata,
handles, varargin)
set(handles.sol final,'enable','off')
set(handles.ejecutar,'enable','off')
global condicion
condicion=0;
a=imread('unsch.jpg');
axes(handles.escudo);
imshow(a);
handles.output = hObject;
guidata(hObject, handles);
function varargout = Taylor by Yover1 OutputFcn(hObject,
eventdata, handles)
varargout{1} = handles.output;
function lee funcion Callback(hObject, eventdata, handles)
fun=get(hObject,'String');
handles.fun=fun;
handles.output = hObject;
guidata(hObject, handles);
function lee intervalo Callback(hObject, eventdata, handles)
I=str2num(get(hObject,'String'));
handles.I=I;
handles.output = hObject;
guidata(hObject, handles);
function lee tpaso Callback(hObject, eventdata, handles)
h=str2double(get(hObject,'String'));
handles.h=h;
handles.output = hObject;
guidata(hObject, handles);
function lee ci Callback(hObject, eventdata, handles)
ci=str2double(get(hObject,'String'));
set(handles.ejecutar,'enable','on')
handles.ci=ci;
handles.output = hObject;
guidata(hObject, handles);
function ejecutar Callback(hObject, eventdata, handles)
global condicion
if condicion==1
fun=get(handles.lee funcion,'string');
I=str2num(get(handles.lee intervalo,'string'));
h=str2double(get(handles.lee tpaso,'string'));
U(1)=str2double(get(handles.lee ci,'string'));
LATEX
15
Ingeniera Civil
UNSCH
else
fun=handles.fun;
I=handles.I;
h=handles.h;
U(1)=handles.ci;
end
syms x y
n{1,1}=' n';
n{2,1}=sprintf(' %4d',0);
fun=vpa(fun);
Fx=diff(fun,x);
Fy=diff(fun,y);
f=inline(fun,'x','y');
fx=inline(Fx,'x','y');
fy=inline(Fy,'x','y');
n{1,1}=' n';
n{2,1}=sprintf(' %4d',0);
a=I(1);
b=I(2);
t(1)=a;
N=(ba)/h;
p{1,1}=' x';
p{2,1}=sprintf(' %4.2f',t(1));
u{1,1}=' y';
u{2,1}=sprintf(' %8.6f',U(1));
for i=1:N
n{i+2,1}=sprintf(' %4d',i);
U(i+1)=U(i)+h*(f(t(i),U(i)))+(h2/2)*(fx(t(i),U(i))+fy(t(i),
U(i))*f(t(i),U(i)));
u{i+2,1}=sprintf(' %8.6f',U(i+1));
t(i+1)=a+(i*h);
p{i+2,1}=sprintf(' %4.2f',t(i+1));
end
set(handles.lst x,'string',p)
set(handles.lst y,'string',u)
set(handles.list n,'string',n)
plot(handles.grafico,t,U,'r')
sol=['y(',num2str(t(end)),')=',num2str(U(end))];
set(handles.sol final,'string',sol)
guidata(hObject, handles);
axes(handles.grafico);
xlabel('Eje x')
ylabel('Eje y')
grid on;
function limpiar Callback(hObject, eventdata, handles)
set(handles.lee funcion,'string','')
set(handles.lee intervalo,'string','')
set(handles.lee tpaso,'string','')
set(handles.lee ci,'string','')
LATEX
16
Ingeniera Civil
UNSCH
set(handles.lst x,'string','')
set(handles.lst y,'string','')
axes(handles.grafico);
set(handles.list n,'string','')
set(handles.sol final,'string','')
set(handles.ejecutar,'enable','off')
plot(0,0)
function prueba Callback(hObject, eventdata, handles)
global condicion
k=get(handles.d1,'string');
set(handles.lee funcion,'string',k);
k=get(handles.d2,'string');
set(handles.lee intervalo,'string',k);
k=get(handles.d3,'string');
set(handles.lee tpaso,'string',k)
k=get(handles.d4,'string');
set(handles.lee ci,'string',k)
set(handles.ejecutar,'enable','on')
condicion=1;
function lst x Callback(hObject, eventdata, handles)
function lst y Callback(hObject, eventdata, handles)
function sol final Callback(hObject, eventdata, handles)
function list n Callback(hObject, eventdata, handles)
function listbox4 Callback(hObject, eventdata, handles)
function escudo ButtonDownFcn(hObject, eventdata, handles)
function axes3 ButtonDownFcn(hObject, eventdata, handles)
function text12 ButtonDownFcn(hObject, eventdata, handles)
1.5.
1.5.1.
1.5.2.
LATEX
17
Ingeniera Civil
UNSCH
RESULTADOS: La aproximaci
on a los valores Y(XF) y Z(XF): Y0 y Z0.
Paso 1. Hacer H=(XFX0)/N
Paso 2. Hacer I=1
Paso 3. Mientras I=N, repetir los pasos 4 a 15.
Paso 4. Hacer K1=F1(X0,Y0,Z0)
Paso 5. Hacer C1=F2(X0,Y0,Z0)
Paso 6. Hacer K2=F1(X0+H/2,Y0+H/2*K1,Z0+H/2*C1)
Paso 7. Hacer C2=F2(X0+H/2,Y0+H/2*K1,Z0+H/2*C1)
Paso 8. Hacer K3=F1(X0+H/2,Y0+H/2*K2,Z0+H/2*C2)
Paso 9. Hacer C3=F2(X0+H/2,Y0+H/2*K2,Z0+H/2*C2)
Paso 10. Hacer K4=F1(X0+H,Y0+H*K3,Z0+H*C3)
Paso 11. Hacer C4=F2(X0+H,Y0+H*K3,Z0+H*C3)
Paso 12. Hacer Y0=Y0+H/6*(K1+2*K2+2*K3+K4)
Paso 13. Hacer Z0=Z0+H/6*(C1+2*C2+2*C3+C4)
Paso 14. HacerX0=X0+H
Paso 15. Hacer I=I+1
Paso 16.IPRIMIR Y0, Z0 Y TERMINAR
1.5.3.
CODIGO EN MATLAB
LATEX
18
Ingeniera Civil
UNSCH
LATEX
19
Ingeniera Civil
UNSCH
U2(1)=handles.ci2;
end
F1=inline(fun1,'x','u1','u2');
F2=inline(fun2,'x','u1','u2');
n{1,1}=' n';
n{2,1}=sprintf(' %4d',0);
a=I(1); b=I(2);
t(1)=a; N=(ba)/h;
p1{1,1}=' x';
p1{2,1}=sprintf(' %4.2f',t(1));
u1{1,1}=' u1y(x)';
u1{2,1}=sprintf(' %8.6f',U1(1));
u2{1,1}=' u2y''(x)';
u2{2,1}=sprintf(' %8.6f',U2(1));
for i=1:N
n{i+2,1}=sprintf(' %4d',i);
k1=h*F1(t(i),U1(i),U2(i));
m1=h*F2(t(i),U1(i),U2(i));
k2=h*F1(t(i)+h/2,U1(i)+1/2*k1,U2(i)+1/2*m1);
m2=h*F2(t(i)+h/2,U1(i)+1/2*k1,U2(i)+1/2*m1);
k3=h*F1(t(i)+h/2,U1(i)+1/2*k2,U2(i)+1/2*m2);
m3=h*F2(t(i)+h/2,U1(i)+1/2*k2,U2(i)+1/2*m2);
k4=h*F1(t(i)+h,U1(i)+k3,U2(i)+m3);
m4=h*F2(t(i)+h,U1(i)+k3,U2(i)+m3);
U1(i+1)=U1(i)+1/6*(k1+2*k2+2*k3+k4);
U2(i+1)=U2(i)+1/6*(m1+2*m2+2*m3+m4);
u1{i+2,1}=sprintf(' %8.6f',U1(i+1));
u2{i+2,1}=sprintf(' %8.6f',U2(i+1));
t(i+1)=a+(i*h);
p1{i+2,1}=sprintf(' %4.2f',t(i+1));
p2{i+2,1}=sprintf(' %4.2f',t(i+1));
end
set(handles.lst x,'string',p1)
set(handles.lst U1,'string',u1)
set(handles.lst U2,'string',u2)
set(handles.list n,'string',n)
plot(handles.grafico,t,U1,'r',t,U2,'b')
sol1=['y(',num2str(t(end)),')=',num2str(U1(end))];
set(handles.sol final,'string',sol1)
guidata(hObject, handles);
axes(handles.grafico);
xlabel('Eje x')
ylabel('Eje y')
legend('y(x)', 'y''(x)')
grid on;
function limpiar Callback(hObject, eventdata, handles)
set(handles.lee funcion1,'string','')
LATEX
20
Ingeniera Civil
UNSCH
set(handles.lee funcion2,'string','')
set(handles.lee intervalo,'string','')
set(handles.lee tpaso,'string','')
set(handles.lee ci1,'string','')
set(handles.lee ci2,'string','')
set(handles.lst x,'string','')
set(handles.lst U1,'string','')
set(handles.lst U2,'string','')
set(handles.sol final,'string','')
set(handles.list n,'string','')
set(handles.ejecutar,'enable','off')
axes(handles.grafico);
plot(0,0)
function prueba Callback(hObject, eventdata, handles)
global condicion
k=get(handles.f1,'string');
set(handles.lee funcion1,'string',k);
k=get(handles.f2,'string');
set(handles.lee funcion2,'string',k);
k=get(handles.d2,'string');
set(handles.lee intervalo,'string',k);
k=get(handles.d3,'string');
set(handles.lee tpaso,'string',k)
k=get(handles.u1,'string');
set(handles.lee ci1,'string',k)
k=get(handles.u2,'string');
set(handles.lee ci2,'string',k)
set(handles.ejecutar,'enable','on')
condicion=1;
function lst x Callback(hObject, eventdata, handles)
function lst U1 Callback(hObject, eventdata, handles)
function sol final Callback(hObject, eventdata, handles)
function lst U2 Callback(hObject, eventdata, handles)
function list n Callback(hObject, eventdata, handles)
function escudo ButtonDownFcn(hObject, eventdata, handles)
function uipanel1 ButtonDownFcn(hObject, eventdata, handles)
LATEX
21
Ingeniera Civil
Captulo 2
PLANTEAMIENTO
DE
DISCUSION
PROBLEMAS
2.1.
Ejercicio 1
Para el problema y 0 = y x2 + 1,
0 x 2,
22
y (0) = 0,5
UNSCH
Soluci
on
Primero por metodo de euler modificado:
LATEX
23
Ingeniera Civil
UNSCH
24
Ingeniera Civil
UNSCH
Ejercicio 2
utilice valores iniciales exactos y despues compare los valores de los resultados
reales de; y 0 = xe3x 2y,
0 x 1, y (0) = 0 con h=0.2 y la solucion
reales
1
1
1
y (x) = xe3x e3x + e2x
5
24
25
Soluci
on
1 3x
Primero resolveremos la solucion real cuando x=1 en y (x) = 15 xe3x 24
e +
1 2x
e
25
1
1
1
y (1) = (1)e3(1) e3(1) + e2(1)
5
24
25
y (1) = 3,18562342417
LATEX
25
Ingeniera Civil
UNSCH
LATEX
26
Ingeniera Civil
UNSCH
LATEX
27
Ingeniera Civil
UNSCH
Por ultimo comparamos los valores obtenidos con el valor real (se efectuado en el Excel):
M
etodo Analtico:
M
etodo Euler Modificado:
M
etodo Predicci
on-Correcci
on:
M
etodo Runge Kutta:
M
etodo Taylor:
y(1)=
3.1856
3.5465
3.2451
3.2222
3.9926
Error Absoluto
0.0000
0.3609
0.0595
0.0366
0.8070
Error Relativo
0.0000
0.1133
0.0187
0.0115
0.2533
Porcentaje de Error en %
0.0000
11.3291
1.8678
1.1489
25.3327
Ejercicio 3
Utilice valores iniciales exactos y despues compare los valores de los resultados reales de y 0 = cos2x sin3x ,
0 x 1, y (0) = 1, con h=0.2 y la
solucion real es
1
4
1
y (x) = sin2x cos3x +
2
3
3
Soluci
on
Primero resolveremos la solucion real cuando x=1 en: y (x) = 21 sin2x
1
cos3x + 43
3
1
1
4
y (1) = sin2(1) cos3(1) +
2
3
3
y (1) = 2,11797954561
Pasaremos a resolver aplicando los metodos numericos:
Por Metodo de Euler Modificado:
LATEX
28
Ingeniera Civil
UNSCH
29
Ingeniera Civil
UNSCH
Por ultimo comparamos los valores obtenidos con el valor real(se efectuado en el Excel):
LATEX
30
Ingeniera Civil
UNSCH
M
etodo Analtico:
M
etodo Euler Modificado:
M
etodo Predicci
on-Correcci
on:
M
etodo Runge Kutta:
M
etodo Taylor:
y(1)=
2.1179
2.0919
2.1192
2.1180
2.1712
Error Absoluto
0.0000
0.0260
0.0013
0.0001
0.0533
Error Relativo
0.0000
0.0123
0.0006
0.0000
0.0252
Porcentaje de Error en %
0.0000
1.2276
0.0614
0.0047
2.5166
Ejercicio 4
Utilice valores iniciales exactos y despues compare los valores de los resultados reales de y 0 = 1 + (x y)2 ,
2 x 3, y (2) = 1, con h=0.5 y la
1
solucion real es y (x) = x + 1x .
Soluci
on
Primero resolveremos la solucion real cuando x=3 en: y (x) = x +
y (3) = 3 +
1
1x
1
13
y (3) = 2,5
Pasaremos a resolver aplicando los metodos numericos:
Por Metodo de Euler Modificado:
31
Ingeniera Civil
UNSCH
32
Ingeniera Civil
UNSCH
Por ultimo comparamos los valores obtenidos con el valor real (se efectuado en el Excel):
M
etodo Analtico:
M
etodo Euler Modificado:
M
etodo Predicci
on-Correcci
on:
M
etodo Runge Kutta:
M
etodo Taylor:
y(1)=
2.5000
2.4815
2.4999
2.4999
2.4258
Error Absoluto
0.0000
0.0185
0.0001
0.0001
0.0742
Error Relativo
0.0000
0.0074
0.0000
0.0000
0.0297
Porcentaje de Error en %
0.0000
0.7400
0.0040
0.0040
2.9680
x
1+lnx
2
1 + ln2
y (2) = 1,181232
Pasaremos a resolver aplicando los metodos numericos:
Por Metodo de Euler Modificado:
LATEX
33
Ingeniera Civil
UNSCH
34
Ingeniera Civil
UNSCH
Por ultimo comparamos los valores obtenidos con el valor real (se efectuado en el Excel):
LATEX
35
Ingeniera Civil
UNSCH
M
etodo Analtico:
M
etodo Euler Modificado:
M
etodo Predicci
on-Correcci
on:
M
etodo Runge Kutta:
M
etodo Taylor:
y(1)=
1.1812
1.1808
1.1812
1.1812
1.1827
Error Absoluto
0.0000
0.0004
0.0000
0.0000
0.0015
Error Relativo
0.0000
0.0003
0.0000
0.0000
0.0013
Porcentaje de Error en %
0.0000
0.0339
0.0000
0.0000
0.1270
36
Ingeniera Civil
UNSCH
37
Ingeniera Civil
UNSCH
Por ultimo comparamos los valores obtenidos con el valor real (se efectuado en el Excel):
M
etodo Analtico:
M
etodo Euler Modificado:
M
etodo Predicci
on-Correcci
on:
M
etodo Runge Kutta:
M
etodo Taylor:
y(1)=
5.7530
5.7076
5.8739
5.8738
5.7655
Error Absoluto
0.0000
0.0454
0.1209
0.1208
0.0125
Error Relativo
0.0000
0.0079
0.0210
0.0210
0.0022
Porcentaje de Error en %
0.0000
0.7892
2.1015
2.0998
0.2173
y (2) = 3 + 2 1 + e2(2)
1
y (2) = 1,0359
Pasaremos a resolver aplicando los metodos numericos:
1. Por Metodo de Euler Modificado:
LATEX
38
Ingeniera Civil
UNSCH
39
Ingeniera Civil
UNSCH
LATEX
40
Ingeniera Civil
UNSCH
Por ultimo comparamos los valores obtenidos con el valor real (se efectuado en el Excel):
M
etodo Analitico:
M
etodo Euler Modificado:
M
etodo Predicci
on-Correcci
on:
M
etodo Runge Kutta:
M
etodo Taylor:
y(1)=
-1.0359
-1.0392
-1.0361
-1.0369
-1.0373
Error Absoluto
0.0000
0.0033
0.0002
0.0010
0.0014
Error Relativo
0.0000
0.0032
0.0002
0.0010
0.0014
Porcentaje de Error en %
0.0000
0.3186
0.0193
0.0965
0.1351
LATEX
41
Ingeniera Civil
UNSCH
LATEX
42
Ingeniera Civil
UNSCH
Por ultimo comparamos los valores obtenidos con el valor real (se efectuado en el Excel):
M
etodo Analitico:
M
etodo Euler Modificado:
M
etodo Predicci
on-Correcci
on:
M
etodo Runge Kutta:
M
etodo Taylor:
y(1)=
1.0022
1.0096
1.0021
1.0360
1.0030
Error Absoluto
0.0000
0.0074
0.0001
0.0338
0.0008
Error Relativo
0.0000
0.0074
0.0001
0.0337
0.0008
Porcentaje de Error en %
0.0000
0.7384
0.0100
3.3726
0.0798
43
Ingeniera Civil
UNSCH
44
Ingeniera Civil
UNSCH
Por ultimo comparamos los valores obtenidos con el valor real (se efectuado en el Excel):
LATEX
45
Ingeniera Civil
UNSCH
M
etodo Analitico:
M
etodo Euler Modificado:
M
etodo Predicci
on-Correcci
on:
M
etodo Runge Kutta:
M
etodo Taylor:
2.2.
y(1)=
5.3862
5.3729
5.3862
5.3862
5.3940
Error Absoluto
0.0000
0.0133
0.0000
0.0000
0.0078
Error Relativo
0.0000
0.0025
0.0000
0.0000
0.0014
Porcentaje de Error en %
0.0000
0.2469
0.0000
0.0000
0.1448
0 x 5,
y (0) = 2
Soluci
on
LATEX
46
Ingeniera Civil
UNSCH
LATEX
47
Ingeniera Civil
UNSCH
LATEX
48
Ingeniera Civil
UNSCH
El ejercicio propuesto se encuentra en la pagina n 304
Ejercicio 2
dy
Utilizando el metodo de la serie de Taylor, resuelve la ecuacion dx
=
x 5,
y (0) = 2 considerando un h=0.001.
3
,
2+y
Soluci
on
1. Por Metodo de Euler Modificado:
LATEX
49
Ingeniera Civil
UNSCH
50
Ingeniera Civil
UNSCH
Soluci
on
1. Por Metodo de Euler Modificado:
LATEX
51
Ingeniera Civil
UNSCH
52
Ingeniera Civil
UNSCH
53
Ingeniera Civil
UNSCH
Ejercicio 4
dy
Implementando la regla trapezoidal para resolver la ecuacion: dx
+ 3y =
x
4xe , 0 x 10,
y (0) = 0,1 considerando un h=0.005.
Soluci
on
1. Por Metodo de Euler Modificado:
LATEX
54
Ingeniera Civil
UNSCH
55
Ingeniera Civil
UNSCH
Soluci
on
1. Por Metodo de Euler Modificado:
LATEX
56
Ingeniera Civil
UNSCH
LATEX
57
Ingeniera Civil
UNSCH
58
Ingeniera Civil
UNSCH
Soluci
on
1. Por Metodo de Euler Modificado:
LATEX
59
Ingeniera Civil
UNSCH
60
Ingeniera Civil
UNSCH
61
Ingeniera Civil
UNSCH
Ejercicio 7
dy
Implementando el metodo de euler para resolver la ecuacion: dx
+ 7y =
7x
e , 0 x 1, y (0) = 0,01 considerando un h=0.001.
Soluci
on
1. Por Metodo de Euler Modificado:
LATEX
62
Ingeniera Civil
UNSCH
63
Ingeniera Civil
UNSCH
Soluci
on
1. Por Metodo de Euler Modificado:
LATEX
64
Ingeniera Civil
UNSCH
LATEX
65
Ingeniera Civil
UNSCH
66
Ingeniera Civil
UNSCH
Soluci
on
1. Por Metodo de Euler Modificado:
LATEX
67
Ingeniera Civil
UNSCH
68
Ingeniera Civil
UNSCH
69
Ingeniera Civil
UNSCH
Ejercicio 10
dy
Por el metodo de Runge Kutta de tercer orden, resuelva la ecuacion: dx
+9y =
4x
e sen(500x), 0 x 1, y (0) = 1 considerando un h=0.01.
Soluci
on
1. Por el Metodo de Euler Modificado:
LATEX
70
Ingeniera Civil
UNSCH
71
Ingeniera Civil
UNSCH
LATEX
72
Ingeniera Civil
UNSCH
2.3.
0 x 1,5,
y (0) = 5
Soluci
on
Primero por metodo de Euler Modificado:
LATEX
73
Ingeniera Civil
UNSCH
74
Ingeniera Civil
UNSCH
75
Ingeniera Civil
UNSCH
Ejercicio 2
Para el problema (n 4)y 0 = 4x 2y + 1,
considerando un h=0.05.
0 x 0,5,
y (0) = 2
Soluci
on
Primero por metodo de Euler Modificado:
LATEX
76
Ingeniera Civil
UNSCH
77
Ingeniera Civil
UNSCH
0 x 0,5,
y (0) = 0 considerando
Soluci
on
Primero por metodo de Euler Modificado:
LATEX
78
Ingeniera Civil
UNSCH
79
Ingeniera Civil
UNSCH
80
Ingeniera Civil
UNSCH
Ejercicio 4
Para el problema (n 6)y 0 = x2 +y 2 ,
un h=0.05.
0 x 0,5,
y (0) = 1 considerando
Soluci
on
Primero por metodo de Euler Modificado:
LATEX
81
Ingeniera Civil
UNSCH
82
Ingeniera Civil
UNSCH
0 x 0,5,
y (0) = 0 considerando
Soluci
on
LATEX
83
Ingeniera Civil
UNSCH
84
Ingeniera Civil
UNSCH
85
Ingeniera Civil
UNSCH
Ejercicio 6
Para el problema (n 8)y 0 = x + y 2 ,
un h=0.05.
0 x 0,5,
y (0) = 0 considerando
Soluci
on
Primero por metodo de Euler Modificado:
LATEX
86
Ingeniera Civil
UNSCH
87
Ingeniera Civil
UNSCH
0 x 0,5,
y (0) = 0,5
Soluci
on
Primero por metodo de Euler Modificado:
LATEX
88
Ingeniera Civil
UNSCH
89
Ingeniera Civil
UNSCH
90
Ingeniera Civil
UNSCH
Ejercicio 8
Para el problema (n 10)y 0 = xy +
considerando un h=0.05.
y,
0 x 0,5,
y (0) = 1
Soluci
on
Primero por metodo de Euler Modificado:
LATEX
91
Ingeniera Civil
UNSCH
92
Ingeniera Civil
UNSCH
0 x 1,5,
y (1) = 1
Soluci
on
Primero por metodo de Euler Modificado:
LATEX
93
Ingeniera Civil
UNSCH
94
Ingeniera Civil
UNSCH
95
Ingeniera Civil
UNSCH
Ejercicio 10
Para el problema (n 12)y 0 = y y 2 ,
considerando un h=0.05.
0 x 0,5,
y (0) = 0,5
Soluci
on
Primero por metodo de Euler Modificado:
LATEX
96
Ingeniera Civil
UNSCH
97
Ingeniera Civil
UNSCH
LATEX
98
Ingeniera Civil
UNSCH
2.4.
2 x 3, con
99
u2 (x)
u1 (x)2
Ingeniera Civil
UNSCH
u1 (2) = y (2) = 2; ; u2 (2) = y 0 (2) = 0,5
Solucion:
Primero por metodo de Runge Kutta para sistemas:
y (3) = 2,4495
El ejercicio propuesto se encuentra en la pagina n 330
Ejercicio n 02:calcular y(0,5)la ecuacion siguiente por medio del metody
d2 y
y (0) =
do Runge Kutta de orden 4, (1 + x2 ) dx
2 2 (x + 1) dx + 6y = 0,
1
0
2 ; ; y (0) = 0 con h = 0,1.
Linealizando obtenemos:
1 + x2 u02 2 (x + 1) u2 + 6u1 = 0
f1 (x) = u2 (x)
f2 (x) =
(2(x + 1) u2 + 6u1 )
(1 + x2 )
1
u1 (0) = y (0) = ; u2 (0) = y 0 (0) = 0
2
Solucion:
Primero por metodo de Runge Kutta para sistemas:
LATEX
100
Ingeniera Civil
UNSCH
y (0,5) = 1,1278
El ejercicio propuesto se encuentra en la pagina n 330
Ejercicio n 03:Un proyectil de masa m = 0,11 kg. Se lanza verticalmente
hacia arriba con una velocidad inicial v (0) = 8 sm2 , y se va frenando debida
a la fuerza de gravedad y a la resistencia del aire, donde g = 9,8 sm2 , y
k = 0,002 kg
.
m
La ecuacion diferencial para la velocidad v esta dado por: mv 0 = mg
2
kv
Calcular v1 seg por metodo de Runge Kutta con h = 0,2
2
Linealizando obtenemos: v = dy
; v 0 = ddt2y
dt
d2 y
dy 2
m 2 = mg k( )
dt
dt
0
mu2 = mg ku1 2
f1 (x) = u2 (x)
f2 (x) = g
k 2
0,002 2
u1 = 9,81
u1
m
0,11
LATEX
101
Ingeniera Civil
UNSCH
y (1) = 3,055
El ejercicio propuesto se encuentra en la pagina n 330
2
Ejercicio n 04:Resolver la ecuacion diferencial ddt2y +2t dy
+t2 y = et , si y (0) =
dt
0
1; ; y (0) = 1 con h = 0,1 para obtener aproximadamente y (0,4)
Linealizando obtenemos: dy
= u2 ; y = u1 ; t = x
dt
d2 y
0
2 = u2
dt
u02 + 2tu2 + t2 u1 = et
f1 (x) = u2 (x)
f2 (x) = et 2tu2 t2 u1 = ex 2xu2 x2 u1
u1 (0) = y (0) = 1; u2 (0) = y 0 (0) = 1; ;
t [0 0,4] ; ;
h = 0,1
Solucion:
Primero por metodo de Runge Kutta para sistemas:
LATEX
102
Ingeniera Civil
UNSCH
y (0,4) = 0,422370
LATEX
103
Ingeniera Civil
UNSCH
2.5.
LATEX
104
Ingeniera Civil
UNSCH
Las corrientes I (t) , I(t) en los circuitos izquierdos y derechos respectivamente del circuito mostrado en la figura son las:
I10 = f1 (t, I1 , I2 ) = 4I1 + 3I 2 + 6
I10 = f1 (t, I1 , I2 ) = 2, 4I1 + 1, 6I 2 + 3,6
I1 (0) = 0
I2 (0) = 0
Cuya solucion analitica es:
I1 (t) = 3,325e2t + 1,875e0,4t
I2 (t) = 2,25 + 2,25e0,4t + 1,5
Linealizando tenemos:
De todo lo anterior para el program realizamos:
u01 (x) = 3,325u1 (x) + 3u2 (x) + 6
u02 (x) = 2,4u1 (x) + 1,6u2 (x) + 3,6
u1 (0) = I1 (0) = 0; u2 (0) = I2 (0) = 0; ;
t [0 10] ; ;
h = 0,1
Solucion:
Primero por metodo de Runge Kutta para sistemas:
LATEX
105
Ingeniera Civil
UNSCH
LATEX
106
Ingeniera Civil
UNSCH
2.6.
y 0 (1) = 2
y (3) =?
107
Ingeniera Civil
UNSCH
u1 (1) = 1 ; ; u2 (1) = 2
LATEX
108
Ingeniera Civil
UNSCH
dv
= AV P
dt
!
a3
v = 5a
3
A = (0,1)2
4
!
3
d 5a2
= (0,1)2 4,895 a
3
4
da
4,895(0,1)2 a
=
dt
4(10a a2 )
2
PV I
da
dt
a
= 0,012375
(10aa2 )
a (0) = 4
a (3) = 3
h = 10 seg
109
Ingeniera Civil
UNSCH
110
Ingeniera Civil
UNSCH
LATEX
111
Ingeniera Civil
UNSCH
bh3
0,3 0,53
=
= 0,00625
12
12
y 00 = v20 ; ;
y = v1
Reemplazando en la ecuacion:
f1 = v2
f2 =
v2 = y 0 (0) = 0; ;
7000x 7000(7)
Px PL
=
EI
2400 103 0,00625
v1 = y (0) = 0; ;
h = 0,5; ;
L (0 8)
Solucion:
Primero por metodo de Runge Kutta para sistemas:
LATEX
112
Ingeniera Civil
UNSCH
LATEX
113
Ingeniera Civil
UNSCH
2.7.
d2 y
dy
+ Ky = 0; ;
2 +B
dx
dt
y (0) = 1, y 0 (0) = 0.
LATEX
114
Ingeniera Civil
UNSCH
LATEX
Ku1 Bu2
= 200u1 20u2
M
M
u2 (0) = 0; ;
h = 0,005, (0 0,75)
115
Ingeniera Civil
Captulo 3
CONCLUSIONES
1. Los programas elaborados en Matlab esta elaborado para solucionar
2. problemas de ecuaciones diferenciales de primer orden (PVI) y ecuaciones diferenciales de segundo orden (PVI) con metodos numericos.
3. Podemos concluir que los metodos numericos empleados en este trabajo pueden ser aplicados en el futuro ejercicio profesional para poder
afrontar problemas de manera practica.
4. Se puede apreciar que los ejercicios resueltos con los programas, tienen
tambien solucion analtica se comparan los errores con una hoja de
calculo en el Excel.
5. En este trabajo se utilizo diversos programas de computo para poder
ensamblar en un entorno mas amigable.
6. Los resultados obtenidos analticamente se comprobo con los resultados
7. obtenidos con el programa elaborado en Matlab y se aprecia que los
metodos numericos empleados tienen diferentes respuestas puesto que
la convergencia varia de acuerdo a cada metodo utilizado.
8. Los programas fueron elaborados en el matlab en el entorno guide en
las cuales utilizamos las estructuras (if,for,else,function,etc).
9. Consientes que dicho trabajo puede ser aun mejorado nos obliga aseguir
investigando.
10. Ahora que ponemos en uso los metodos numericos y la posterior elaboracion de programas podemos visualizar que tiene un uso amplio y
muy interesante en la aplicacion de la ingeniera.
116
Captulo 4
BIBLIOGRAFIA
[1] Jose Alberto Gutierrez Robles, Analisis numerico.
[2] LiudmilaChainskaia, Elizabeth Doig, Elementos de Analisis Numerico algoritmos y aplicaciones.
[3] Dr. Luis Americo carrasco Venegas,Metodos numericos aplicados ala ingeniera.
[4] shoichiroNakamura, Metodos numericos aplicados con software.
[5] Ricardo seminario Vazquez, Metodos numericos para ingeniera.
[6] Antoni Huerta Corezuelo, Josep Sarrate Ramos, Metodos numericos introduccion aplicaciones y propagacion.
[7] Steven C. Chapra, Raymond P. Canale, Metodos numericos para ingenieros.
[8] Antonio Nieves Federico C. Domnguez, Metodos numericos para ingenieros
[9] Richard L Burden, J. Douglas Faires, Analisisnumericos.
[10] Dennis G Zill,Ecuaciones diferenciales con aplicaciones de modelado.
117