You are on page 1of 8

Ejercicio 5.

Solución

1. Se despeja la función
2𝑔𝐻
𝑓(𝐻) = √2𝑔𝐻tanh⁡(√ 2∗𝐿 ∗ 𝑡)-v

Reemplazando valores:

2∗9.81∗𝐻
𝑓(𝐻) = √2 ∗ 9.81𝐻tanh⁡(√ 2∗4
∗ 2.5)-5

Usamos el método de la bisección en Matlab


Scrip :
function root = bisectnew(func,xl,xu,Ead)
% bisectnew(xl,xu,es,maxit):
% uses bisection method to find the root of a function
% with a fixed number of iterations to attain
% a prespecified tolerance
% input:
% func = name of function
% xl, xu = lower and upper guesses
% Ead = (optional) desired tolerance (default = 0.000001)
% output:
% root = real root
if func(xl)*func(xu)>0 %if guesses do not bracket a sign change
error('no bracket') %display an error message and terminate
end
% if necessary, assign default values
if nargin<4, Ead = 0.000001; end %if Ead blank set to 0.000001
% bisection
xr = xl;
% compute n and round up to next highest integer
n = round(1 + log2((xu - xl)/Ead) + 0.5);
for i = 1:n
xrold = xr;
xr = (xl + xu)/2;
if xr ~= 0, ea = abs((xr - xrold)/xr) * 100; end
test = func(xl)*func(xr);
if test < 0
xu = xr;
elseif test > 0
xl = xr;
2. y en la ventana de comandos ejecutamos la función para hallar la raíz:

>> fcd = inline('sqrt(2*9.81*cd)*tanh(sqrt(2*9.81*cd/8)*2.5)-5','cd')

fcd =

Inline function:

fcd(cd) = sqrt(2*9.81*cd)*tanh(sqrt(2*9.81*cd/8)*2.5)-5

>> format long

>> bisectnew(fcd,0,4,0.0000001)

ans =

1.274947315454483
Se puede realizar el método de la bisección usando Excel:

1.se da valores a f(H) para graficar la función

H f(H)
0 -5
1 -
0.57407339
2 1.26398951
3 2.67200735
4 3.85889104

f(H)
5
4
3
2
1
0
-1 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5

-2
-3
-4
-5
-6

2. método de la bisección:

iteracion Xa Xb Xr f(Xa) f(Xr) f(Xa)f(Xr) Ea(%)


1 0 4 2 -5 1.26398951 -6.31994757
2 0 2 1 -5 - 2.87036697 100
0.57407339
3 1 2 1.5 - 0.42420024 -0.24352207 33.3333333
0.57407339
4 1 1.5 1.25 - - 0.0282961 20
0.57407339 0.04929005
5 1.25 1.5 1.375 - 0.1929181 -0.00950894 9.09090909
0.04929005
6 1.25 1.375 1.3125 - 0.07327931 -0.00361194 4.76190476
0.04929005
7 1.25 1.3125 1.28125 - 0.01237478 -0.00060995 2.43902439
0.04929005
8 1.25 1.28125 1.265625 - - 0.000905 1.2345679
0.04929005 0.01836077
9 1.265625 1.28125 1.2734375 - - 5.4513E-05 0.61349693
0.01836077 0.00296901
10 1.2734375 1.28125 1.27734375 - 0.00470885 -1.3981E-05 0.3058104
0.00296901
11 1.2734375 1.27734375 1.275390625 - 0.00087142 -2.5872E-06 0.15313936
0.00296901
12 1.2734375 1.27539063 1.274414063 - - 3.1128E-06 0.07662835
0.00296901 0.00104842
13 1.27441406 1.27539063 1.274902344 - -8.8409E- 9.2689E-08 0.0382995
0.00104842 05
14 1.27490234 1.27539063 1.275146484 -8.8409E- 0.00039153 -3.4614E-08 0.01914608
05
15 1.27490234 1.27514648 1.275024414 -8.8409E- 0.00015157 -1.34E-08 0.00957396
05
16 1.27490234 1.27502441 1.274963379 -8.8409E- 3.158E-05 -2.7919E-09 0.00478721
05
17 1.27490234 1.27496338 1.274932861 -8.8409E- -2.8414E- 2.512E-09 0.00239366
05 05
18 1.27493286 1.27496338 1.27494812 -2.8414E- 1.583E-06 -4.498E-11 0.00119682
05
19 1.27493286 1.27494812 1.274940491 -2.8414E- -1.3415E- 3.8119E-10 0.00059841
05 05
20 1.27494049 1.27494812 1.274944305 -1.3415E- -5.9162E- 7.9369E-11 0.00029921
05 06
21 1.27494431 1.27494812 1.274946213 -5.9162E- -2.1666E- 1.2818E-11 0.0001496
06 06
22 1.27494621 1.27494812 1.274947166 -2.1666E- -2.9178E- 6.3216E-13 7.4801E-05
06 07
23 1.27494717 1.27494812 1.274947643 -2.9178E- 6.4563E-07 -1.8838E-13 3.7401E-05
07
24 1.27494717 1.27494764 1.274947405 -2.9178E- 1.7692E-07 -5.1623E-14 1.87E-05
07
25 1.27494717 1.2749474 1.274947286 -2.9178E- -5.7428E- 1.6756E-14 9.3501E-06
07 08
26 1.27494729 1.2749474 1.274947345 -5.7428E- 5.9748E-08 -3.4312E-15 4.6751E-06
08
27 1.27494729 1.27494735 1.274947315 -5.7428E- 1.1602E-09 -6.6626E-17 2.3375E-06
08
28 1.27494729 1.27494732 1.274947301 -5.7428E- -2.8134E- 1.6157E-15 1.1688E-06
08 08
29 1.2749473 1.27494732 1.274947308 -2.8134E- -1.3487E- 3.7943E-16 5.8438E-07
08 08
30 1.27494731 1.27494732 1.274947312 -1.3487E- -6.1633E- 8.3123E-17 2.9219E-07
08 09
31 1.27494731 1.27494732 1.274947314 -6.1633E- -2.5016E- 1.5418E-17 1.461E-07
09 09
32 1.27494731 1.27494732 1.274947315 -2.5016E- -6.7069E- 1.6778E-18 7.3048E-08
09 10
33 1.27494731 1.27494732 1.274947315 -6.7069E- 2.4475E-10 -1.6415E-19 3.6524E-08
10
34 1.27494731 1.27494731 1.274947315 -6.7069E- -2.1297E- 1.4284E-19 1.8262E-08
10 10
35 1.27494731 1.27494731 1.274947315 -2.1297E- 1.5889E-11 -3.3838E-21 9.131E-09
10
36 1.27494731 1.27494731 1.274947315 -2.1297E- -9.8543E- 2.0987E-20 4.5655E-09
10 11
37 1.27494731 1.27494731 1.274947315 -9.8543E- -4.1327E- 4.0725E-21 2.2827E-09
11 11
38 1.27494731 1.27494731 1.274947315 -4.1327E- -1.272E-11 5.2566E-22 1.1414E-09
11
39 1.27494731 1.27494731 1.274947315 -1.272E-11 1.5836E-12 -2.0143E-23 5.7069E-10
40 1.27494731 1.27494731 1.274947315 -1.272E-11 -5.5671E- 7.0811E-23 2.8534E-10
12
41 1.27494731 1.27494731 1.274947315 -5.5671E- -1.9922E- 1.1091E-23 1.4267E-10
12 12
42 1.27494731 1.27494731 1.274947315 -1.9922E- -2.0339E- 4.052E-25 7.1336E-11
12 13
43 1.27494731 1.27494731 1.274947315 -2.0339E- 6.8923E-13 -1.4018E-25 3.5668E-11
13
44 1.27494731 1.27494731 1.274947315 -2.0339E- 2.4336E-13 -4.9498E-26 1.7834E-11
13
45 1.27494731 1.27494731 1.274947315 -2.0339E- 1.954E-14 -3.9743E-27 8.917E-12
13
46 1.27494731 1.27494731 1.274947315 -2.0339E- -9.1482E- 1.8607E-26 4.4585E-12
13 14
47 1.27494731 1.27494731 1.274947315 -9.1482E- -3.5527E- 3.2501E-27 2.2292E-12
14 14
48 1.27494731 1.27494731 1.274947315 -3.5527E- -7.9936E- 2.8399E-28 1.1146E-12
14 15
49 1.27494731 1.27494731 1.274947315 -7.9936E- 0 0 5.5731E-13
15
50 1.27494731 1.27494731 1.274947315 0 0 0 0
51 1.27494731 1.27494731 1.274947315 0 0 0 0

La raíz H=1.274947315

USANDO EL METODO DE LLA FALSA POSICION

ITERACIONES Xa Xb f(Xa) f(Xb) Xr f(Xa).f(Xb) E


1 0 4 -5 3.85889104 2.25761892 -19.2944552
2 0 2.25761892 -5 1.65530664 1.69610436 -8.27653321 33.1061328
3 0 1.69610436 -5 0.76824137 1.47020924 -3.84120687 15.3648275
4 0 1.47020924 -5 0.36999264 1.36891179 -1.8499632 7.3998528
5 0 1.36891179 -5 0.18138684 1.32098975 -0.90693422 3.62773689
6 0 1.32098975 -5 0.08969775 1.29770943 -0.44848877 1.79395508
7 0 1.29770943 -5 0.04454624 1.28624991 -0.22273122 0.8909249
8 0 1.28624991 -5 0.02216967 1.28057194 -0.11084834 0.44339336
9 0 1.28057194 -5 0.01104495 1.2777494 -0.05522477 0.22089907
10 0 1.2777494 -5 0.00550549 1.27634402 -0.02752745 0.11010978
11 0 1.27634402 -5 0.00274499 1.27564369 -0.01372496 0.05489986
12 0 1.27564369 -5 0.00136881 1.27529457 -0.00684405 0.02737619
13 0 1.27529457 -5 0.00068261 1.27512049 -0.00341305 0.01365221
14 0 1.27512049 -5 0.00034042 1.27503368 -0.00170211 0.00680843
15 0 1.27503368 -5 0.00016977 1.27499038 -0.00084886 0.00339545
16 0 1.27499038 -5 8.4669E-05 1.27496879 -0.00042334 0.00169337
17 0 1.27496879 -5 4.2226E-05 1.27495803 -0.00021113 0.00084452
18 0 1.27495803 -5 2.1059E-05 1.27495266 -0.00010529 0.00042118
19 0 1.27495266 -5 1.0503E-05 1.27494998 -5.2513E-05 0.00021005
20 0 1.27494998 -5 5.2378E-06 1.27494864 -2.6189E-05 0.00010476
21 0 1.27494864 -5 2.6122E-06 1.27494798 -1.3061E-05 5.2244E-05
22 0 1.27494798 -5 1.3028E-06 1.27494765 -6.5138E-06 2.6055E-05
23 0 1.27494765 -5 6.4972E-07 1.27494748 -3.2486E-06 1.2994E-05
24 0 1.27494748 -5 3.2403E-07 1.2749474 -1.6201E-06 6.4806E-06
25 0 1.2749474 -5 1.616E-07 1.27494736 -8.08E-07 3.232E-06
26 0 1.27494736 -5 8.0593E-08 1.27494734 -4.0297E-07 1.6119E-06
27 0 1.27494734 -5 4.0194E-08 1.27494733 -2.0097E-07 8.0387E-07
28 0 1.27494733 -5 2.0045E-08 1.27494732 -1.0023E-07 4.0091E-07
29 0 1.27494732 -5 9.9971E-09 1.27494732 -4.9985E-08 1.9994E-07
30 0 1.27494732 -5 4.9857E-09 1.27494732 -2.4929E-08 9.9715E-08
31 0 1.27494732 -5 2.4865E-09 1.27494732 -1.2432E-08 4.973E-08
32 0 1.27494732 -5 1.2401E-09 1.27494732 -6.2003E-09 2.4801E-08
33 0 1.27494732 -5 6.1845E-10 1.27494732 -3.0922E-09 1.2369E-08
34 0 1.27494732 -5 3.0843E-10 1.27494731 -1.5422E-09 6.1687E-09
35 0 1.27494731 -5 1.5382E-10 1.27494731 -7.6912E-10 3.0765E-09
36 0 1.27494731 -5 7.6714E-11 1.27494731 -3.8357E-10 1.5343E-09
37 0 1.27494731 -5 3.8257E-11 1.27494731 -1.9129E-10 7.6515E-10
38 0 1.27494731 -5 1.9081E-11 1.27494731 -9.5404E-11 3.8162E-10
39 0 1.27494731 -5 9.5159E-12 1.27494731 -4.758E-11 1.9032E-10
40 0 1.27494731 -5 4.7455E-12 1.27494731 -2.3728E-11 9.4917E-11
41 0 1.27494731 -5 2.3679E-12 1.27494731 -1.1839E-11 4.7354E-11
42 0 1.27494731 -5 1.1804E-12 1.27494731 -5.9019E-12 2.3616E-11
43 0 1.27494731 -5 5.8797E-13 1.27494731 -2.9399E-12 1.1756E-11
44 0 1.27494731 -5 2.931E-13 1.27494731 -1.4655E-12 5.8692E-12
45 0 1.27494731 -5 1.4655E-13 1.27494731 -7.3275E-13 2.9259E-12
46 0 1.27494731 -5 7.3719E-14 1.27494731 -3.6859E-13 1.4804E-12
47 0 1.27494731 -5 3.5527E-14 1.27494731 -1.7764E-13 7.1406E-13
48 0 1.27494731 -5 1.7764E-14 1.27494731 -8.8818E-14 3.4832E-13
49 0 1.27494731 -5 8.8818E-15 1.27494731 -4.4409E-14 1.7416E-13
50 0 1.27494731 -5 0 1.27494731 0 0
51 1.27494731 1.27494731 0 0 #¡DIV/0! 0 #¡DIV/0!
LA RAIZ H=1.27494731

You might also like