You are on page 1of 8

CAPÍTULO 10

1. Resuelva los siguientes problemas en 0≤t≤5 utilizando el método de Euler hacia


adelante con h=0.5, calculando manualmente. Repita con h=0.01 en MATLAB.
Evalúe los errores comparando con las soluciones exactas que se muestran más
adelante.
(a) y´+ ty = 1; y (0)=1
(b) y´+3y = e-t; y (0) = 1
(c) y´= (t2-y); y (0) = 0,5
(d) y´ +y│y│= 0; y(0) = 1
(e) y´+ │y│1/2 = Sen (t); y (0) =1

CASO (A) (B) (C) (D) (E)


T Y Y Y Y Y
0 1.0000 1.0000 0.5000 1.0000 1.0000
1 1.3313 0.2088 0.4482 0.5000 0.6147
2 0.7753 0.06890 1.7969 0.3333 0.7458
3 0.4043 2.4955E-2 4.9253 0.2500 0.4993
4 0.2707 9.1610E-3 9.9725 0.2000 -0.2714
5 0.2092 3.3692E-3 16.980 0.1665 -2.2495

(a) y´+ ty = 1; y (0)=1

Ingrese la function diferencial y´= 1-( t.*y)


Ingrese el valor inicial de t=0
Ingrese el valor final de t=5
Ingrese el intervalo h=0.01
Ingrese el valor inicial de y(0)=1
n y
0 1.0000
1 1.3313
2 0.7753
3 0.4043
4 0.2707
5 0.2092

(b) y´+3y = e-t; y (0) = 1

Ingrese la function diferencial y´=(exp(-t))-(3.*y)


Ingrese el valor inicial de t=0
Ingrese el valor final de t=5
Ingrese el intervalo h=0.01
Ingrese el valor inicial de y(0)=1
n y
0 0.9800
1 0.2073
2 0.0686
3 0.0249
4 0.0091
5 0.0034

(c) y´= (t2-y); y (0) = 0,5

Ingrese la function diferencial y´=(t.^2-y)


Ingrese el valor inicial de t=0
Ingrese el valor final de t=5
Ingrese el intervalo h=0.01
Ingrese el valor inicial de y(0)=0.5
n y
0 0.4950
1 0.4446
2 1.7904
3 4.9169
4 9.9633
5 16.9802

(d) y´ +y│y│= 0; y(0) = 1

Ingrese la function diferencial y´= (- y).*│y│


Ingrese el valor inicial de t=0
Ingrese el valor final de t=5
Ingrese el intervalo h=0.01
Ingrese el valor inicial de y (0) = 1
n y
0 1.000
1 0.500
2 0.333
3 0.250
4 0.200
5 0.166

(e) y´+ │y│1/2 = Sen (t); y (0) =1

Ingrese la function diferencial y´= Sen (t) - │y│1/2


Ingrese el valor inicial de t=0
Ingrese el valor final de t=5
Ingrese el intervalo h=0.01
Ingrese el valor inicial de y (0) = 1
n y
0 1.000
1 0.614
2 0.745
3 0.499
4 -0.271
5 -2.249
2. Resuelva: y’’(t)-0.05y’(t) +0.15y(t)=0 ; y’(0)=0, y(0)=1 y encuentre los valores de
y (1) y y(2) utilizando el método de Euler hacia adelante con h=0.5

Ingrese el valor de h= 0.5


Ingrese t1=0
Ingrese t2=5
Ingrese la función =
y ′′ (t) − 0.05y ′ (t) + 0.15y(t) = 0, y ′ (0) = 0, y(0) = 1
Ingrese condición inicial de yo=1
y1 = 1.0199, y1 = 1.0297, y1 = 1.0394,
y1 =1.0490, y1 = 1.058, y1 =1.0678, y1
=1.0771
y1 = 1.0862, y1 = 1.0952
y1 = 0.2125, y1 =0.2120,y1 = 0.2116, y1
= 0.2111, y1 =0.2106, y1 = 0.2101
y1 = 0.2097, y1 =0.2092, y1 = 0.2088

3. Resuelva los siguientes problemas en 0 ≤ t ≤ 5 utilizando el método de Euler hacia


adelante con h=0.1 y h=0.01 (escriba su propio programa en MATLAB). Evalúe los
errores con las soluciones exactas que se muestran más adelante.
(a) y''+8y=0, y(0)=1, y' (0)=0
(b) y''-0.01(y' )2+2y=sen(t), y(0)=0, y' (0)=1
(c) y''+2ty'+ty=0, y(0)=1, y' (0)=0
(d) (et+y) y''=t, y(0)=1, y' (0)=0

CASO (A) (B) (C) (D)


T Y Y Y Y
0 1.0 0.0000 1.0000 1.0000
1 -0.9514 0.8450 0.8773 1.0629
2 -0.8102 0.9135 0.5372 1.3653
3 -0.5902 0.1412 0.3042 1.8926
4 0.3128 -0.7540 0.1763 2.5589
5 -0.0050 -0.9589 0.1035 3.2978

(a) y’’ +8y=0, y(0)=1 y’(0)=0


Ingrese el valor de h=0.01
Ingrese t1= 0
Ingrese t2= 5
Ingrese la función=1-t*y
Ingrese condición inicial de yo 1
y1 = 1.0199, y1 = 1.0297, y1 = 1.0394, y1 =1.0490, y1 = 1.058, y1
=1.0678, y1 =1.0771
y1 = 1.0862, y1 = 1.0952
y1 = 0.2125, y1 =0.2120, y1 = 0.2116, y1 = 0.2111, y1 =0.2106, y1 =
0.2101
y1 = 0.2097, y1 =0.2092, y1 = 0.2088
ans= 1-t*y

(b) y’’ -0.01(y’)2 +2y=sen (t) y(0)=0, y’(0)=1´


Ingrese el valor de h=0.01
Ingrese t1=0
Ingrese t2=5
Ingrese la función=exp(-t)-3*y
Ingrese condición inicial de yo= 1
y1 = 1.0070, y1 =1.0101,y1 = 1.0128,y1 = 1.0153,y1 =1.0174,y1
=1.0192,y1 =1.0207,y1 =1.0219
y1 = 1.0228, y1 = 1.0234
y1 = -2.6777,y1 = -2.6797,y1 = -2.6818,y1 = -2.683, y1 =-2.6860,y1
=-2.6881, y1 =-2.6901
y1 = -2.6922, y1 = -2.6943
ans = exp(-t)-3*y
(c) y’’ +2ty+ty=0 y(0)=t , y’(0)=0
Ingrese el valor de h=0.01
Ingrese t1=0
Ingrese t2=5
Ingrese la función=(t^2)-y
Ingrese condición inicial de yo=0.5
y1 =0.5049,y1 = 0.5073, y1 = 0.5095,y1 =0.5117,y1 = 0.5139, y1 =
0.5159,y1 = 0.5179,y1 =0.5197,y1 =0.5215
y1 =-2.1710,y1 =-2.1734,y1 =-2.175, y1 =-2.1781,y1 = -2.1805,y1 = -
2.1828, y1 = -2.1852
ans =
Inline function:
ans(t,y) = (t^2)-y

(d) (𝓮𝐭 +y)y’’ =t y(0)=1, y’(0)=0


Ingrese el valor de h=0.01
Ingrese t1=0
Ingrese t2=5
Ingrese la función=sin(t)-(y^1/2)
Ingrese condición inicial de yo= 1
y1 = 1.0168,y1 =1.0252,y1 =1.0336,y1 = 1.0420,y1 = 1.0504,y1 =
1.0588,y1 =1.0671,y1 =1.0755,y1 =1.0839,y1 = 1.0922
y1 =-1.2462,y1 = -1.2803,y1 = -1.3146,y1 =-1.349,y1 = -1.3836, y1
= -1.4183, y1 = -1.4530

5. Un tanque cónico contiene agua hasta una altura de 0.5 m desde el fondo. El
tanque tiene un agujero de 0.02 m de radio en el fondo. El radio del tanque en y está
dado por r= 0.25y donde r es el radio y y es la altura medida desde el fondo. La
velocidad del agua que sale por el agujero está dada por v2=2gy donde g=9.81m/s2.
Utilice el método de Euler hacia adelante con h=0.001s para averiguar cuantos
minutos tardara el tanque en vaciarse.
𝑦 𝑑𝑉 𝑑𝑦 𝑑𝑉
V=∫0 𝐴(𝑦) 𝑑𝑦 𝑑𝑡
= 𝐴(𝑦) 𝑑𝑡 𝑑𝑡
= −𝑎 𝑣 𝑣 = √2𝑔𝑦
𝑑𝑦
𝐴(𝑦) 𝑑𝑡 = −𝑎 √2𝑔𝑦
𝐴(𝑦)𝑑𝑦 = −𝑎 √2𝑔𝑦 𝑑𝑡

A(y)=𝜋 (0.25y)2 , a=0.02m, g=9.8m/s2


π(0.25y)2 dy = -0.02 √2(9.8)𝑦 dt

𝑑𝑦 −0.02 √2(9.8)𝑦
𝑑𝑡
= π(0.25y)2

𝑑𝑦
𝑑𝑡
= −0.451𝑦 −1.5 ; y(0)=0.5
6. Un circuito tiene una auto inductancia de L=100 mH una resistencia de R=20ohms
y una fuente de voltaje de 10V. Si el interruptor se cierra en t=0, la corriente I(t)
cambia según:

𝑑𝐼(𝑡)
𝐿 + 𝐼(𝑡)𝑅 = 𝐸; 𝐼(0) = 0
𝑑𝑡
(a) Determine la corriente en t=1,2,3,4 y 5 ms por el método de Euler hacia adelante
con h=0.01
(b) Evalué el error al compararlo con los resultados analíticos
(c) Investigue el efecto de h repitiendo los cálculos con h=0.1

>> euler
ingrese la ecuación diferencial de la forma y´=f(t,y). y´=
(-3*y+7*y+2*t)/4
ingrese el tiempo inicial t0 = 0
ingrese el tiempo final tf = 5
ingrese la condición inicial y(0) = 1
ingrese el tamaño del intervalo h = 0.01
Condición inicial: y(0.00) = 1.0000
n = 50 y(0.50) = 1.7169
n = 100 y(1.00) = 3.0572
n = 150 y(1.50) = 5.4226
n = 200 y(2.00) = 9.4740
n = 250 y(2.50) = 16.2982
n = 300 y(3.00) = 27.6827
n = 350 y(3.50) = 46.5671
n = 400 y(4.00) = 77.7862
n = 450 y(4.50) = 129.2912
n = 500 y(5.00) = 214.1592

>> euler
ingrese la ecuación diferencial de la forma y´=f(t,y). y´=
(-3*y+7*y+2*t)/4
ingrese el tiempo inicial t0 = 0
ingrese el tiempo final tf = 5
ingrese la condición inicial y(0) = 1
ingrese el tamaño del intervalo h = 0.01
Condición inicial: y(0.00) = 1.0000
n = 50 y(0.50) = 1.7169
n = 100 y(1.00) = 3.0572
n = 150 y(1.50) = 5.4226
n = 200 y(2.00) = 9.4740
n = 250 y(2.50) = 16.2982
n = 300 y(3.00) = 27.6827
n = 350 y(3.50) = 46.5671
n = 400 y(4.00) = 77.7862
n = 450 y(4.50) = 129.2912
n = 500 y(5.00) = 214.1592

>> euler
ingrese la ecuación diferencial de la forma y´=f(t,y). y´=
(-3*y+7*y+2*t)/4
ingrese el tiempo inicial t0 = 0
ingrese el tiempo final tf = 5
ingrese la condición inicial y(0) = 1
ingrese el tamaño del intervalo h = 0.001
Condición inicial: y(0.000) = 1.0000
n = 500 y(0.500) = 1.7225
n = 1000 y(1.000) = 3.0754
n = 1500 y(1.500) = 5.4675
n = 2000 y(2.000) = 9.5725
n = 2500 y(2.500) = 16.5009
n = 3000 y(3.000) = 28.0832
n = 3500 y(3.500) = 47.3364
n = 4000 y(4.000) = 79.2337
n = 4500 y(4.500) = 131.9724
n = 5000 y(5.000) = 219.0643

7𝑧 ′ = −2𝑦 + 8𝑧, 𝑧(0) = 0

>> euler
ingrese la ecuación diferencial de la forma y´=f(t,y). y´=
(-2*t+8*y)/7
ingrese el tiempo inicial t0 = 0
ingrese el tiempo final tf = 5
ingrese la condición inicial y(0) = 0
ingrese el tamaño del intervalo h = 0.01
Condición inicial: y(0.00) = 0.0000
n = 50 y(0.50) = -0.0424
n = 100 y(1.00) = -0.2128
n = 150 y(1.50) = -0.6092
n = 200 y(2.00) = -1.4045
n = 250 y(2.50) = -2.9038
n = 300 y(3.00) = -5.6460
n = 350 y(3.50) = -10.5817
n = 400 y(4.00) = -19.3892
n = 450 y(4.50) = -35.0307
n = 500 y(5.00) = -62.7345

>> euler
ingrese la ecuación diferencial de la forma y´=f(t,y). y´=
(-2*t+8*y)/7
ingrese el tiempo inicial t0 = 0
ingrese el tiempo final tf = 5
ingrese la condición inicial y(0) = 0
ingrese el tamaño del intervalo h = 0.001
Condición inicial: y(0.000) = 0.0000
n = 500 y(0.500) = -0.0435
n = 1000 y(1.000) = -0.2167
n = 1500 y(1.500) = -0.6197
n = 2000 y(2.000) = -1.4293
n = 2500 y(2.500) = -2.9589
n = 3000 y(3.000) = -5.7627
n = 3500 y(3.500) = -10.8223
n = 4000 y(4.000) = -19.8753
n = 4500 y(4.500) = -35.9974
n = 5000 y(5.000) = -64.6331

11. Un tanque cónico contiene agua hasta una altura de 0.5 m desde el fondo. El
tanque tiene un agujero de 0.02 m de radio en el fondo. El radio del tanque en y está
dado por r= 0.25y donde r es el radio y y es la altura medida desde el fondo. La
velocidad del agua que sale por el agujero está dada por v2=2gy donde g=9.81m/s2.
Utilice el método de Euler hacia adelante con h=0.001s para averiguar cuantos
minutos tardara el tanque en vaciarse.
𝒚 𝒅𝑽 𝒅𝒚 𝒅𝑽
V=∫𝟎 𝑨(𝒚) 𝒅𝒚 = 𝑨(𝒚) 𝒅𝒕 = −𝒂 𝒗 𝒗 = √𝟐𝒈𝒚
𝒅𝒕 𝒅𝒕
𝒅𝒚
𝑨(𝒚) 𝒅𝒕 = −𝒂 √𝟐𝒈𝒚
𝑨(𝒚)𝒅𝒚 = −𝒂 √𝟐𝒈𝒚 𝒅𝒕

A(y)=𝜋 (0.25y)2 , a=0.02m, g=9.8m/s2


π(0.25y)2 dy = -0.02 √2(9.8)𝑦 dt

𝑑𝑦 −0.02 √2(9.8)𝑦
=
𝑑𝑡 π(0.25y)2

𝑑𝑦
= −0.451𝑦 −1.5 ; y(0)=0.5
𝑑𝑡

>> euler
ingrese la ecuación diferencial de la forma y´=f(t,y). y´=
-0.451*y^(-1.5)
ingrese el tiempo inicial t0 = 0
ingrese el tiempo final tf = 1
ingrese la condición inicial y(0) = 0.5
ingrese el tamaño del intervalo h = 0.001
Condición inicial: y(0.00) = 0.5000
n = 25 y(0.025) = 0.4665
n = 50 y(0.050) = 0.4290
n = 75 y(0.075) = 0.3858
n = 100 y(0.100) = 0.3338
n = 125 y(0.125) = 0.2656
n = 150 y(0.150) = 0.1496
n = 159 y(0.159) = 0.0034
n = 160 y(0.160) = -2.3204
El tanque se vaciará después de 0.160S

12. Encuentre y(1) para la siguiente ecuación empleando el método de Runge-Kutta


de segundo orden con h=0.5:
𝒚
𝒚′ = 𝒕+𝒚𝟐 y(0) = 1

Editor:
function f=fn_1(y,t)
f=y./(t+(y.^2))
clear,clf,hold on
h=0.5;
n=1;
y(1)=0;t(1)=0;
y_rec(1)=y; t_rec(1)=0;t=0;
while t(n)<1
k1=h*fn_1(y(n),t);
k2=h*fn_1(y(n)+k1,t);
y(n+1)=( y(n)) + ( 0.5*(k1+k2));
t(n+1)=n*h;
n=n+1;
end

Comand Window
>> kutta
f =
1.3771

You might also like