Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
i. Interpole: Sk (xk ) = yk
ii. Continua: Sk1 (xk ) = Sk (xk )
0
0
iii. 1 Derivada Continua: Sk1 (xk ) = Sk (xk )
00
00
n+1 restricciones
n-1 restricciones
n-1 restricciones
n-1 restricciones
Spline
Spline
Spline
Spline
00
00
ak
k)
3. Construccin de la Spline: se define ck = S (x
, hk = xk+1 xk , k = ak+1
, k = 3 (k k1 ) y se resuelve
2
hk
el sistema matricial de n+1 incgnitas
c
0
0
Fila
condicin
de
borde
en
x0
c1 1
h0 2 (h0 + h1 )
h
0
...
...
...
0
2
c2
0
h
2
(h
+
h
)
h
0
...
...
0
1
1
2
2
. .
. .
0
0
h
2
(h
+
h
)
h
0
...
0
2
2
3
3
. .
..
..
..
..
..
= .
..
.
.
0
0
.
.
.
...
.
. .
. .
.
.
.
.
.
.
..
..
..
..
..
..
.. ..
...
0
0
0
0
0
...
hn2 2 (hn2 + hn1 ) hn1 cn1
n1
Fila
condicin
de
borde
en
xn
cn
bk =
ak+1 ak
hk (2ck + ck+1 )
hk
3
dk =
ck+1 ck
3hk
Problemas
1) Determine la spline sujeta de la funcin f (x) = cos(x) en los puntos equiespaciados: x0 = 0, x1 =
3
4 , x4 = 1.
Solucin:
1
4 , x2
1
2 , x3
2
y0 = cos(0) = 1, y1 = cos( 4 ) = 22 , y2 = cos( 2 ) = 0, y3 = cos( 3
4 ) = 2 , y4 = cos() = 1. Primero se necesita
calcular h0 , h1 , h2 , h3 y a0, a1 , a2 , a3 , a4 . Como los puntos son equiespaciados: h0 = h1 = h2 = h3 = 14 . Los ak se
3(a a )
1
0
0
3f
(x
)
0
h0
c0
2h0
h0
0
0
0
1)
0)
h0 2(h0 + h1 )
c1 3(a2ha
3(a1ha
h
0
0
1
1
0
3(a3 a
3(a2 a1 )
2)
h1
2(h1 + h2 )
h2
0
c2 =
h2
h1
0
3(a4 a3 )
2)
0
hn2
2(hn2 + hn1 ) hn1 cn1
3(a3ha
h3
2
0
0
0
hn1
2hn1
cn
3)
3f 0 (xn ) 3(a4ha
3
1
4
1
2
1
4
0
0
1
1
4
0
0
0
1
4
0
0
1
4
1
0
1
4
1
4
0
0
0
1
4
1
2
c0
c1
c2
c3
c4
c0
c1
c2
c3
c4
12( 22
1)
12(1 2)
0
12(1 2)
12( 22 1)
5. 193 3
3. 672 2
0
3. 672 2
5. 193 3
3. 514 7
4. 970 6
0
=
4. 970 6
3. 514 7
Finalmente se tienen que determinar los bk y dk . Para ello se utilizan las ecuaciones:
Luego:
bk
= (ak+1 ak )
dk
1
hk
(ck+1 + 2ck )
hk
3
k = 0, ..., n 1
1
(ck+1 ck ) k = 0, ..., n 1
3hk
(a1 a0 ) h10 (c1 + 2c0 ) h30
b0
0
b1
(a2 a1 ) h11 (c2 + 2c1 ) h31
2.2164
=
=
b2
(a3 a2 ) h12 (c3 + 2c2 ) h32 3.1344
2.2164
b3
(a4 a3 ) h13 (c4 + 2c3 ) h33
1
2.0281
d0
3h0 (c1 c0 )
d1 3h1 (c2 c1 ) 4.8963
1
d2 = 1 (c3 c2 ) = 4.8963
3h2
1
2.0281
d3
3h (c4 c3 )
2) En los ltimos aos, el precio de la bencina en Chile a tenido fuertes alzas. A continuacin se muestran algunos datos
sobre el precio de la bencina 95 octanos desde Diciembre del 2004 hasta Agosto del 2006:
F echa
15/12/04 27/01/05 22/03/05 09/05/05 13/06/05 18/08/05
P esos/Litro
488
508
553
564
543
576
F echa
15/09/05 08/10/05 04/11/05 12/01/06 29/04/06 15/06/06
P esos/Litro
619
628
587
566
636
668
A partir de los datos, en funcin de los das transcurridos desde el 15/12/04 construya la Spline Cbica.
3) En el parque nacional Torres del Paine, situado en la XII Regin de Chile, un turista amigo suyo sac una fotografa a
las torres:
La Organizacin Internacional del Medio Ambiente desea hacer estudios sobre la composicin de las rocas de las Torres
del Paine, pero para realizar esto se necesita la funcin de altura de las Torres. Modele esta funcin mediante una
Spline Cbica, a partir de la fotografa. Grafique la funcin.
4) Construyamos mediante splines cbicas el contorno de la citroneta de la fotografa:
i) Primero, se realiza la toma de datos usando una malla cuadriculada sobre la fotografa:
k 0
: xk 2
yk 5
1
2
3
4
5
6
7
8
9
10 11 12
2.7 3.8 6
8
10
13
16 18 21
25 30 36
7.8 9 10 10.2 10.3 10.4 14.5 15 15.4 15.5 14 5
k
hk
k
k
k
0
0.7
2.8
0.7 = 4
1
1.1
1.2
12
1.1 = 11
12
3 ( 11 4) = 96
11
= xk+1 xk
yk+1 yk
=
hk
= 3 (k k1 )
2
2.2
5
1
2.2 = 11
5
12
3 ( 11 11 ) = 21
11
0.2
2
1
3 ( 10
3
2
=
1
10
5
11 )
= 117
110
k
hk
k
k
hk
k
k
0.1
2
1
( 20
4
2
=
1
20
1
10 ) =
3
20
8
3
2
0.4
3 = 15
2
1
7
3 ( 15 4 ) = 20
0.1
3
1
30
1
20 ) =
20
9
4
1
0.1
4 = 40
1
2
3 ( 40 15 ) = 13
40
1
0
0
7 18 11
5
10
10 11
33
0
10
5
11
0
0
5
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
( 30
5
3
=
6
7
3
2
4.1
0.5
41
1
3 = 30
2 = 4
41
1
1
41
67
3 ( 30 30 ) = 4 3 ( 4 30 ) = 20
10
11
5
6
1.5
3
9
3
5 = 10
6 = 2
3
1
39
3
3
18
3 ( 10 40 ) = 40 3 ( 2 + 10 ) = 5
00
00
2
0
0
0
0
0
0
0
0
0
0 0 0 0 0 0 0 0 0
c0
96
0 0 0 0 0 0 0 0 0
c1 11
21
0 0 0 0 0 0 0 0 0
11
c2 117
2 0 0 0 0 0 0 0 0
c3 110
8 2 0 0 0 0 0 0 0 c4 20
1
2 10 3 0 0 0 0 0 0
c5 20
0 3 12 3 0 0 0 0 0
c6 = 467
0 0 3 10 2 0 0 0 0 c7 20
7
0 0 0 2 10 3 0 0 0
c8 20
13
0 0 0 0 3 14 4 0 0
c9 40
39
0 0 0 0 0 4 18 5 0
c10 40
0 0 0 0 0 0 5 22 6 c11 18
5
0 0 0 0 0 0 0 0 1 c12
0
0
c0
c1 2. 482
0.188 8
c2
0.193 2
c3
0.071 97
c4
0.169 7
c5
:
c6 0.500 9
0.500 7
c7
0.077 07
c8
0.039 77
c9
0.000 133 4
c10
0.163 7
c11
0
hk
3
ck+1 ck
dk =
3hk
k
xk
yk
hk
yk+1 yk
hk
ck
k
xk
yk
hk
yk+1 yk
hk
ck
0
1
2
3
4
5
2
2.7
3.8
6
8
10
5
7.8
9
10
10.2
10.3
0.7
1.1
2.2
2
2
3
4
1. 091 0.454 5
0.1
0.05
0.03 333
0 2. 482 0.188 8 0.193 2 0.071 97 0.169 7
7
8
9
10
11
16
18
21
25
30
14.5
15
15.4
15.5
14
2
3
4
5
6
0.25
0.133 3
0.025
0.3
1. 5
0.500 7 0.077 07 0.039 77 0.000 133 4 0.163 7
6
13
10.4
1. 367
0.500 9
12
36
k=0
S0 (x) = 5 + 4
0.7(202. 482)
3
2
(x 2) + 0 (x 2)2 +
2. 4820
30.7
(x 2)3
80.193 2)
S2 (x) = 9 + 0.454 5 2.2(20.188
(x 3.8) + 0.188 8 (x 3.8)2 +
3
= S2 (x) = 0.848 6x2 3. 623x 0.05788x3 + 13. 69
k=3
0.193 20.188 8
32.2
0.071 97+0.193 2
32
7)+0.500 9)
S5 (x) = 10.3 + 0.033 33 3(2(0.169
(x 10) 0.169 7 (x 10)2 +
3
(x 8)3
0.500 9+0.169 7
33
0.500 70.500 9
33
(x 3.8)3
(x 6)3
0.169 70.071 97
32
(x 2.7)3
(x 10)3
(x 13)3
0.077 07+0.500 7
32
(x 16)3
0.039 770.077 07
33
(x 18)3
133 4)
4+0.039 77
(x 21)3
(x 21) 0.039 77 (x 21)2 + 0.000 13334
S9 (x) = 15.4 + 0.025 4(2(0.039 77)+0.000
3
4)0.163 7)
133 4
(x25)3
S10 (x) = 15.5+ 0.3 5(2(0.000 133
(x25)+0.000 133 4(x25)2 + 0.163 70.000
3
35
= S10 (x) = 0.819 3x2 20. 51x 0.01092 x3 + 186. 9
k = 11
7)+0)
S11 (x) = 14 + 1. 5 6(2(0.163
(x 30) 0.163 7 (x 30)2 +
3
= S11 (x) = 33. 53x 0.982 2x2 + 0.009094x3 353. 5
S(x) =
S0 (x)
S1 (x)
S2 (x)
S3 (x)
S4 (x)
S5 (x)
S6 (x)
S7 (x)
S8 (x)
S9 (x)
S10 (x)
S11 (x)
0+0.163 7
36
(x 30)3
si x [2, 2.7]
si x [2.7, 3.8]
si x [3.8, 6]
si
x [6, 8]
si
x [8, 10]
si x [10, 13]
si x [13, 16]
si x [16, 18]
si x [18, 21]
si x [21, 25]
si x [25, 30]
si x [30, 36]
viii) Propuesto: Calcule la Spline de la parte inferior del contorno del escarabajo, considerando los datos:
xk 2 3 7
12 36
yk 5 4 7.9 3.8 5
d0
d1
d2
..
.
c0
c1
c2
..
.
b0
b1
b2
..
.
a0
a1
a2
..
.
dn2
dn1
cn2
cn1
bn2
bn1
an2
an1
Para evaluar la spline "pp" en puntos distintos a los "breaks" se utilizan las instrucciones (por ejemplo):
xx=(0:0.01:6);
yy=fnval(pp,x);
Se pueden mostrar los detalles de la splines (coefs) mediante la instruccin:
[breaks,coefs,l,k,d] = unmkpp(pp);
Como tambin realizar operaciones sobre la estructura "pp" como por ejemplo derivarla e integrarla:
der_pp = fnder(pp);
der_pp = fnder(pp,dorder);
int_pp = fnint(pp);
int_pp = fnint(pp,value);
Las funciones "fnder" y "fint" devuelven la derivada e integral de la spline en la forma "pp".
Finalmente, podemos graficamos la spline resultante sobre el grfico anterior, mediante:
plot(xx,yy,-r); hold on;
O tambin:
fnplt(pp,-r);
Funcin y=x*cos(x 2) vs Spline sujeta
6
-2
-4
-6
y=xcos(x 2)
spline sujeta
0
3
x