SPLINE CÚBICO

advertisement
MÉTODOS NUMÉRICOS
SPLINE CÚBICO
1. DIBUJO
2. CÓDIGO
function S=splinecubico2(x,y)
n=length(x);
syms X;
for i=1:n-1
h(i)=x(i+1)-x(i);
end
for i=2:n-1
p(i)=3*(y(i+1)*h(i-1)-y(i)*(x(i+1)-x(i-1))+y(i-1)*h(i))/(h(i-1)*h(i));
end
l(1)=1;u(1)=0;z(1)=0;
for i=2:n-1
l(i)=2*(x(i+1)-x(i-1))-h(i-1)*u(i-1);
u(i)=h(i)/l(i);
z(i)=(p(i)-h(i-1)*z(i-1))/l(i);
end
l(n)=1;z(n)=0;c(n)=0;
for j=n-1:-1:1
c(j)=z(j)-u(j)*c(j+1);
b(j)=((y(j+1)-y(j))/h(j))-h(j)*(c(j+1)+2*c(j))/3;
d(j)=(c(j+1)-c(j))/(3*h(j));
end
for i=1:n-1
sj=x(i):.01:x(i+1);
s=y(i)+b(i)*(sj-x(i))+c(i)*(sj-x(i)).^2+d(i)*(sj-x(i)).^3;
hold on
plot(x,y,'x')
plot(sj,s,'m')
ERICK JUNIOR HUAMAN RIVERA
FIC-UNASAM
MÉTODOS NUMÉRICOS
SPLINE CÚBICO
end
for i=1:n-1
s=y(i)+b(i)*(X-x(i))+c(i)*(X-x(i))^2+d(i)*(X-x(i))^3
end
3. COORDENADAS PARA LAS OREJAS DEL LOBO
3.1. Parte Superior
Cálculos:
s=
(4155*X)/1103 - (846*(X + 9)^3)/1103 + 45116/1103
s=
(1617*X)/1103 - (2538*(X + 8)^2)/1103 + (921*(X + 8)^3)/1103 + 23966/1103
s=
(225*(X + 7)^2)/1103 - (696*X)/1103 - (611*(X + 7)^3)/8824 + 6158/1103
s=
(19*(X + 5)^3)/1103 - (933*(X + 5)^2)/4412 - (1425*X)/2206 + 12729/2206
s=
(1735*(X + 3)^3)/4412 - (477*(X + 3)^2)/4412 - (2835*X)/2206 + 6937/2206
s=
(1182*(X + 2)^2)/1103 - (1419*X)/4412 - (5831*(X + 2)^3)/17648 + 11817/2206
s=
(5831*X^3)/17648 - (8037*X^2)/8824 + 7
s=
(1419*X)/4412 + (1182*(X - 2)^2)/1103 - (1735*(X - 2)^3)/4412 + 11817/2206
s=
(2835*X)/2206 - (477*(X - 3)^2)/4412 - (19*(X - 3)^3)/1103 + 6937/2206
s=
(1425*X)/2206 - (933*(X - 5)^2)/4412 + (611*(X - 5)^3)/8824 + 12729/2206
s=
(696*X)/1103 + (225*(X - 7)^2)/1103 - (921*(X - 7)^3)/1103 + 6158/1103
ERICK JUNIOR HUAMAN RIVERA
FIC-UNASAM
MÉTODOS NUMÉRICOS
SPLINE CÚBICO
s=
(846*(X - 8)^3)/1103 - (2538*(X - 8)^2)/1103 - (1617*X)/1103 + 23966/1103
3.2. Al pulsar Enter aparece la figura 1 con su respectivo cálculo anterior.
Figura 1
3.3. Parte Inferior
Cálculos:
s=
(447*(X + 9)^3)/2144 - (2055*X)/536 - 14743/536
s=
(1341*(X + 7)^2)/1072 - (357*X)/268 - (783*(X + 7)^3)/4288 - 2231/268
s=
(128*(X + 3)^3)/603 - (63*(X + 3)^2)/67 - (6*X)/67 + 250/67
s=
- (128*X^3)/603 + (65*X^2)/67 - X/4503599627370496 + 1
s=
(6*X)/67 - (63*(X - 3)^2)/67 + (783*(X - 3)^3)/4288 + 250/67
s=
(357*X)/268 + (1341*(X - 7)^2)/1072 - (447*(X - 7)^3)/2144 - 2231/268
ERICK JUNIOR HUAMAN RIVERA
FIC-UNASAM
MÉTODOS NUMÉRICOS
SPLINE CÚBICO
3.4. Al pulsar Enter aparece la figura 2 y el cálculo anterior.
Figura 2
3.5. Detalles de oreja Izquierda
Cálculos:
s=
(29*X)/6 - (5*(X + 7)^3)/6 + 227/6
s=
(7*X)/3 - (5*(X + 6)^2)/2 + (5*(X + 6)^3)/12 + 22
Cálculos
s=
(2*X)/3 + 26/3
ERICK JUNIOR HUAMAN RIVERA
FIC-UNASAM
MÉTODOS NUMÉRICOS
SPLINE CÚBICO
3.6. Al pulsar Enter en ambos casos aparece la figura 3.
Figura 3
3.7. Detalles de oreja Derecha
Cálculos:
s=
(8*X)/3 - (5*(X - 4)^3)/12 - 14/3
s=
(5*(X - 6)^3)/6 - (5*(X - 6)^2)/2 - (7*X)/3 + 22
Cálculos
s=
26/3 - (2*X)/3
ERICK JUNIOR HUAMAN RIVERA
FIC-UNASAM
MÉTODOS NUMÉRICOS
SPLINE CÚBICO
3.8. Al pulsar Enter en ambos casos aparece la figura 4.
Figura 4
4. COORDENADAS PARA EL HOCICO DEL LOBO
4.1. Parte Inferior:
Cálculos:
s=
(17*X)/4 - (X + 9)^3/4 + 129/4
s=
(7*X)/2 - (3*(X + 8)^2)/4 + (X + 8)^3/4 + 26
Cálculos:
s=
(151*(X + 9)^3)/2796 - (2947*X)/2796 - 14433/932
s=
(151*(X + 8)^2)/932 - (1247*X)/1398 - (179*(X + 8)^3)/11184 - 9881/699
s=
(169*(X + 4)^3)/12582 - (7*(X + 4)^2)/233 - (509*X)/1398 - 7309/699
s=
ERICK JUNIOR HUAMAN RIVERA
FIC-UNASAM
MÉTODOS NUMÉRICOS
SPLINE CÚBICO
(127*(X + 1)^2)/1398 - (127*X)/699 - (6004799503160661*(X +
1)^3)/2596148429267413814265248164610048 - 7117/699
s=
(127*X)/699 + (127*(X - 1)^2)/1398 - (169*(X - 1)^3)/12582 - 7117/699
s=
(509*X)/1398 - (7*(X - 4)^2)/233 + (179*(X - 4)^3)/11184 - 7309/699
s=
(1247*X)/1398 + (151*(X - 8)^2)/932 - (151*(X - 8)^3)/2796 - 9881/699
Cálculos:
s=
(X - 7)^3/4 - (17*X)/4 + 123/4
s=
(3*(X - 8)^2)/4 - (7*X)/2 - (X - 8)^3/4 + 25
4.2. Al pulsar Enter en los tres casos aparece la figura 5.
Figura 5
4.3. Parte Central:
ERICK JUNIOR HUAMAN RIVERA
FIC-UNASAM
MÉTODOS NUMÉRICOS
SPLINE CÚBICO
Cálculos:
s=
- (207*X)/107 - (7*(X + 5)^3)/107 - 1356/107
s=
(35*(X + 4)^3)/107 - (21*(X + 4)^2)/107 - (228*X)/107 - 1447/107
s=
(84*(X + 3)^2)/107 - (165*X)/107 - (113*(X + 3)^3)/856 - 1244/107
s=
(3*X)/214 - (3*(X + 1)^2)/428 + (6004799503160661*(X +
1)^3)/5192296858534827628530496329220096 - 1709/214
s=
(113*(X - 1)^3)/856 - (3*(X - 1)^2)/428 - (3*X)/214 - 1709/214
s=
(165*X)/107 + (84*(X - 3)^2)/107 - (35*(X - 3)^3)/107 - 1244/107
s=
(228*X)/107 - (21*(X - 4)^2)/107 + (7*(X - 4)^3)/107 - 1447/107
4.4. Al pulsar Enter en los tres casos aparece la figura 6.
Figura 6
4.5. Parte Interna:
Cálculos:
s=
(34*X)/23 + (48*(X + 3)^3)/23 - 59/23
s=
(70*X)/23 + (72*(X + 5/2)^2)/23 - (56*(X + 5/2)^3)/23 + 37/23
ERICK JUNIOR HUAMAN RIVERA
FIC-UNASAM
MÉTODOS NUMÉRICOS
SPLINE CÚBICO
s=
(100*X)/23 - (12*(X + 2)^2)/23 + (4*(X + 2)^3)/23 + 108/23
Cálculos:
s=
88/23 - (4*(X - 1)^3)/23 - (88*X)/23
s=
(56*(X - 2)^3)/23 - (12*(X - 2)^2)/23 - (100*X)/23 + 108/23
s=
(72*(X - 5/2)^2)/23 - (70*X)/23 - (48*(X - 5/2)^3)/23 + 37/23
4.6. Al pulsar Enter en ambos casos aparece la figura 7.
Figura 7
4.7. Trufa Del Hocico:
Cálculos:
s=
- 2*X – 10
ERICK JUNIOR HUAMAN RIVERA
FIC-UNASAM
MÉTODOS NUMÉRICOS
SPLINE CÚBICO
Cálculos:
s=
(9*X)/8 - (X + 2)^3/8 - 15/4
s=
(3*X)/4 - (3*(X + 1)^2)/8 - 17/4
s=
(X - 1)^3/8 - (3*(X - 1)^2)/8 - (3*X)/4 - 17/4
Cálculos:
s=
2*X – 10
4.8. Al pulsar Enter en los tres casos aparece la figura 8.
Figura 8
ERICK JUNIOR HUAMAN RIVERA
FIC-UNASAM
MÉTODOS NUMÉRICOS
SPLINE CÚBICO
5. COORDENADAS PARA EL OJO DEL LOBO
5.1. Ojo Izquierdo:
Cálculos:
s=
(4*(X + 5)^3)/15 - (19*X)/15 - 19/3
s=
(4*(X + 4)^2)/5 - (7*X)/15 - (X + 4)^3/3 - 43/15
s=
(2*X)/15 - (X + 3)^2/5 + (X + 3)^3/15 - 3/5
Cálculos:
s=
X/12 - (X + 5)^3/12 + 5/12
s=
(X + 4)^3/24 - (X + 4)^2/4 - X/6 - 2/3
5.2. Al pulsar Enter en los dos casos aparece la figura 9.
Figura 9
ERICK JUNIOR HUAMAN RIVERA
FIC-UNASAM
MÉTODOS NUMÉRICOS
SPLINE CÚBICO
5.3. Ojo Derecho:
Cálculos:
s=
X/15 - (X - 2)^3/15 - 17/15
s=
(X - 3)^3/3 - (X - 3)^2/5 - (2*X)/15 - 3/5
s=
(7*X)/15 + (4*(X - 4)^2)/5 - (4*(X - 4)^3)/15 - 43/15
Cálculos:
s=
(2*X)/3 - (X - 2)^3/24 - 7/3
s=
X/6 - (X - 4)^2/4 + (X - 4)^3/12 - 2/3
ERICK JUNIOR HUAMAN RIVERA
FIC-UNASAM
MÉTODOS NUMÉRICOS
SPLINE CÚBICO
4.4. Al pulsar Enter en los dos casos aparece la figura 10.
ERICK JUNIOR HUAMAN RIVERA
FIC-UNASAM
Download