Minimos Cuadrados Y Splines.docx

  • Uploaded by: Rafa Beltran
  • 0
  • 0
  • November 2019
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Minimos Cuadrados Y Splines.docx as PDF for free.

More details

  • Words: 3,479
  • Pages: 10
Universidad Surcolombia

Mínimos cuadrados y Splines

Presentado al docente: Yamil Armando Cerquera Rojas

Presentado por: Rafael A. Beltrán Cabrera Cód.: 2009288517

Facultad de Ingeniería

Métodos Numéricos Neiva-Huila 2019

I.

tabla incremento salarial últimos 15 años. Año 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013

Salario mínimo mensual 236460 260100 286000 309000 332000 358000 381500 408000 433700 461500 496900 515000 535600 566700 589500

grafico porcentual aumento salario mínimo últimos 15 años.

incremento porcentual del salario minimo en colombia durante los ultimos 15 años. 18 16 14 12

Axis Title

II.

Variación % anual 16,01 10 9,96 8,04 7,44 7,83 6,56 6,95 6,3 6,41 7,68 3,64 4 5,81 4,02

10 8

6 4 2 0

Variación % anual

III.

desarrollo

A. sacar la tabla. Xº Yº

1 16,01

2 10

3 9,96

4 8,04

5 7,44

6 7,83

7 6,56

8 6,95

9 6,3

B. desarrollo de variables. N=15 ∑y=110,60 ∑x=120 ∑x^2=1240 ∑yx=726,35 Y^=a+bx^2

C. remplazamos la variable en la matriz N

∑x

∑y

a =

∑x

∑x^2

∑yx

b

D. remplazamos en la matriz 15

120

a

110,60 =

120

1240

b

726,35

E. sacamos las ecuaciones 15a + 120b = 110,60 120a +1240b = 726,35

10 6,41

11 7,68

12 3,64

13 4

14 5,81

15 4,02

F. desarrollamos las ecuaciones y obtenemos a=11,89 b=-0,5658 G. ahora utilizamos a y b para calcular y^ y^=a+bxº               

y1=11,89-0,5658*1 = 11,3242 y2=11,89-0,5658*2 = 10,7584 y3=11,89-0,5658*3 = 10,1926 y4=11,89-0,5658*4 = 9,6268 y5=11,89-0,5658*5 = 9,061 y6=11,89-0,5658*6 = 8,4952 y7=11,89-0,5658*7 = 7,9294 y8=11,89-0,5658*8 = 7,3636 y9=11,89-0,5658*9 = 6,7978 y10=11,89-0,5658*10 = 6,232 y11=11,89-0,5658*11 = 5,6662 y12=11,89-0,5658*12 = 5,1004 y13=11,89-0,5658*13 = 4,5346 y14=11,89-0,5658*14 = 3,9688 y15=11,89-0,5658*15 = 3,403

H. ahora miramos la gráfica con la línea de mínimos cuadrados

incremento porcentual del salario minimo en colombia durante los ultimos 15 años. Axis Title

20 15 10

Variación % anual

5

minimos cuadrados

Xº Yº Y^

1 16,01 11,324

2 10 10,758

3 9,96 10,193

4 8,04 9,6268

5 7,44 9,061

6 7,83 8,4952

7 6,56 7,9294

8 6,95 7,3636

2013

2012

2011

2010

2009

2008

2007

2006

2005

2004

2003

2002

2001

2000

1999

0

9 6,3 6,7978

10 6,41 6,232

11 7,68 5,6662

12 3,64 5,1004

13 4 4,5346

14 5,81 3,9688

15 4,02 3,403

SPLINE CUBICO x=1:15; y=[16.01 10 9.96 8.04 7.44 7.83 6.56 6.95 6.3 6.41 7.68 3.64 4 5.81 4.02]; plot(x,y,'or');hold on axis([0 17 0 18]); i=1; while i<=14 a(2*i-1,4*i)=x(i).^3; a(2*i-1,4*i-1)=x(i).^2; a(2*i-1,4*i-2)=x(i).^1; a(2*i-1,4*i-3)=1; i=i+1; end a=[1 1 1 1 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 0 0 0 0 0 0 0 0 0 1248000000000000000000000000000000000000 0000124800000000000000000000000000000000 0 0 0 0 1 3 9 27 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 0 0 0 0 0 0 0 0 0 0 0 0 1 3 9 27 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 0 0 0 0 0 0 0 0 1 4 16 64 0 0 0 0 0 0 0 0 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 10 10 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 0 0 0 0 0 0 0 0 0 1 11 12 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 0 1 4 12 0 -1 -4 -12 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 0 0 0 0 0 0 0 1 6 27 0 -1 -6 -27 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 0 0 0 0 0 0 0 1 8 48 0 -1 -8 -48 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 0 0 0 0 0 0 0 1 10 75 0 -1 -10 -75 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 0 0 0 0 0 0 1 12 108 0 -1 -12 -108 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 0 0 0 0 0 1 14 147 0 -1 -14 -147 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 0 0 0 0 0 1 16 192 0 -1 -16 -192 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 0 0 0 0 0 1 18 243 0 -1 -18 -24 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 0 0 0 0 0 0 1 20 300 0 -1 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 0 0 0 0 0 0 0 0 0 0 1 22 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 0 0 2 12 0 0 -2 -12 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 0 0 0 0 0 0 0 0 0 2 18 0 0 -2 -18 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 0 0 0 0 0 0 0 0 0 2 24 0 0 -2 -24 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 0 0 0 0 0 0 0 0 0 2 30 0 0 -2 -30 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 0 0 0 0 0 0 0 0 0 2 36 0 0 -2 -36 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 0 0 0 0 0 0 0 0 0 2 42 0 0 -2 -42 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 0 0 0 0 0 0 0 0 0 2 48 0 0 -2 -48 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 0 0 0 0 0 0 0 0 0 2 54 0 0 -2 -54 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 0 0 0 0 0 0 0 0 0 2 60 0 0 -2 0000000000000000000000000000000000000026 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000

0000000000000000000000000000000000000000 0026000000000000000000000000000000000000 0026000000000000000000000000000000000000 ]; b=[16.01;10;10;9.96;9.96;8.04;8.04;7.44;7.44;7.83;7.83;6.56;6.56;6.95;6.95;6.3;6.3 v=inv(a)*b i=1; while i<=14 a=v(4*i-3); b=v(4*i-2); c=v(4*i-1); d=v(4*i); xx=x(i):0.01:x(i+1); fx=a+b*xx+c*xx.^2+d*xx.^3; plot(xx,fx); i=i+1; end v= 1.0e+003 * 0.0220 -0.0025 -0.0053 0.0018 0.0584 -0.0570 0.0220 -0.0028 -0.0590 0.0603 -0.0171 0.0016 0.0557 -0.0257 0.0044 -0.0002 0.1440 -0.0787 0.0150 -0.0009 -0.3524 0.1695 -0.0264 0.0014 0.5109 -0.2004 0.0265 -0.0012 -0.3847 0.1354 -0.0155 0.0006 -0.3993 0.1403 -0.0161 0.0006 2.8301 -0.8286 0.0808 -0.0026 -5.1927 1.3595

-0.1181 0.0034 2.9309 -0.6714 0.0512 -0.0013 2.6739 -0.6121 0.0466 -0.0012 -3.1798 0.6422 -0.0430 0.0010

SPLINE PARABOLA x=1:15; y=[16.01 10 9.96 8.04 7.44 7.83 6.56 6.95 6.3 6.41 7.68 3.64 4 5.81 4.02]; plot(x,y,'or');hold on axis([0 17 0 18]); i=1; while i<=14 a(2*i-1,4*i-1)=x(i).^2; a(2*i-1,4*i-2)=x(i).^1; a(2*i-1,4*i-3)=1; i=i+1; end a=[1 1 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 0 0 0 0 0 0 0 0 0 0 0 2400000000000000000000000000000000000000 0012400000000000000000000000000000000000 0013900000000000000000000000000000000000 0000013900000000000000000000000000000000 0 0 0 0 0 1 4 16 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 0 0 0 0 0 0 0 0 0 0 0 0 1 4 16 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 0 0 0 0 0 0 0 0 0 1 5 25 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 0 0 0 0 0 0 0 0 0 0 0 0 1 5 25 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 0 0 0 0 0 0 0 0 0 1 6 36 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 0 0 0 0 0 0 0 0 0 0 0 0 1 6 36 0 0 0 0 0 0 0 0 0 0 0 0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 1 24 0 -1 -24 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 0 0 0 0 0 0 0 0 0 1 26 0 -1 -26 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 0 0 0 0 0 0 0 0 0 1 28 0]; b=[16.01;10;10;9.96;9.96;8.04;8.04;7.44;7.44;7.83;7.83;6.56;6.56;6.95;6.95;6.3;6.3 v=inv(a)*b i=1; while i<=13 a=v(4*i-3); b=v(4*i-2); c=v(4*i-1); xx=x(i):0.01:x(i+1); fx=a+b*xx+c*xx.^2; plot(xx,fx); i=i+1; end

v= 1.0e+003 * 0.0270 -0.0110 0.1120 -0.0849 0.0170 -0.2106 0.1301 -0.0189 0.4140 -0.1822 0.0202 -0.5702 0.2115 -0.0192 0.7517 -0.2292 0.0175 -0.8849 0.2384 -0.0159 1.0799 -0.2528 0.0148 -1.2610 0.2674 -0.0141 1.6690 -0.3186 0.0152 -2.6592 0.4684 -0.0205 3.8900 -0.6231 0.0249 -4.2947 0.6360 -0.0235 4.2078 -0.5786 0.0199

DATOS EVALUADOS CON DIFERENTES CURVAS t = [1 2 3 4 5 6 7 8 9 10 11 12 13 14 15]; p = [16.01 10 9.96 8.04 7.44 7.83 6.56 6.95 6.3 6.41 7.68 3.64 4 5.81 4.02]; % t=linspace(-1,1,10); % p=1./(1+25*t.^2); x = 1:0.1:16; %x = linspace(-1,1,100); y = interp1 (t, p, x, 'spline') ; plot (t, p,'o',x, y); hold on y = interp1 (t, p, x, 'linear') ; plot (x, y,'r') y = interp1 (t, p, x, 'nearest') ; plot (x, y,'g') y = interp1 (t, p, x, 'pchip') ; plot (x, y,'b') y = interp1 (t, p, x, 'cubic') ; plot (x, y,'c') y = interp1 (t, p, x, 'v5cubic') ; plot (x, y,'m') hold off %

Related Documents


More Documents from ""

Romberg.docx
June 2020 1
November 2019 11
Rectangular.docx
June 2020 8
Christmas Time Lyrics
November 2019 18