Sunteți pe pagina 1din 25

U412A

Polinomio 4 y 5
X = linspace(-3,3,12)
Y = 3*sin (exp(-x/2))
Tabla de datos y sumatorias
Sistemas de ecuaciones y soluciones
Polinomio y grafica

Ajuste de polinomio grado 4


Tabla de datos
X

ajuste

-3.000000000000000

-2.920519778316971

-3.136246520239999

-2.454545454545455

-0.801116507633982

-0.315671593136276

-1.909090909090909

1.552952540062045

1.485865423905590

-1.363636363636364

2.755325114338886

2.479172941092940

-0.818181818181818

2.993596785794432

2.857239518532725

-0.272727272727273

2.733489951018636

2.795233866231512

0.272727272727273

2.297864622225752

2.450504844095480

0.818181818181818

1.849415392302503

1.962581461930424

1.363636363636363

1.453251190259060

1.453172879441748

1.909090909090909

1.126641540056258

1.026168406234469

2.454545454545454

0.866737862471463

0.767637501813223

3.000000000000000

0.663849792906007

0.745829775582253

>> format long


>> mc2
Elija los

valores de xlinspace(-3,3,12)

x =

Columns 1 through 8

-3.000000000000000 -2.454545454545455
0.272727272727273
0.818181818181818

Columns 9 through 12

-1.909090909090909

-1.363636363636364

-0.818181818181818

-0.272727272727273

1.363636363636363

1.909090909090909

Ingrese las parejas de los datos de

2.454545454545454

3.000000000000000

x3*sin (exp(-x/2))

y =

Columns 1 through 8

-2.920519778316971 -0.801116507633982
2.297864622225752
1.849415392302503

1.552952540062045

2.755325114338886

0.866737862471463

0.663849792906007

2.993596785794432

Columns 9 through 12

1.453251190259060

1.126641540056258

elija el grado del polinomio4

O =

1.0e+004 *

0.001200000000000

-0.000000000000000

0.004254545454545

-0.000000000000000

0.026898572501878

-0.000000000000000

0.004254545454545

-0.000000000000000

0.026898572501878

-0.000000000000000

0.004254545454545

-0.000000000000000

0.026898572501878

-0.000000000000000

0.200566322469280

-0.000000000000000

0.026898572501878

-0.000000000000000

0.200566322469280

-0.000000000000000

0.026898572501878

-0.000000000000000

0.200566322469280

-0.000000000000000

1.613431596510340

bb =

1.0e+002 *

0.145714885054841
0.112025559503709
0.012935635455847
1.145390165764610
-1.280641071645164

2.733489951018636

sistema =
Sistema de

ecuaciones

1.0e+004 *

0.001200000000000

-0.000000000000000

0.004254545454545

-0.000000000000000

0.026898572501878

0.001457148850548

-0.000000000000000

0.004254545454545

-0.000000000000000

0.026898572501878

-0.000000000000000

0.001120255595037

0.004254545454545

-0.000000000000000

0.026898572501878

-0.000000000000000

0.200566322469280

0.000129356354558

-0.000000000000000

0.026898572501878

-0.000000000000000

0.200566322469280

-0.000000000000000

0.011453901657646

0.026898572501878

-0.000000000000000

0.200566322469280

-0.000000000000000

1.613431596510340

-0.012806410716452

Solucion
sol =

2.649071560543259
-0.642661673276221
-0.351650193548361
0.143297154360733
-0.008388002357245

Polinomio
2.649071560543259 +
0.008388002357245*x.^4

-0.642661673276221*x +

-0.351650193548361*x.^2 +

0.143297154360733*x.^3 +

Sumatorias de x
sx'

ans =

1.0e+004 *

-0.000000000000000

x.^1

0.004254545454545

x.^2

-0.000000000000000
0.026898572501878

x.^3
x.^4

-0.000000000000000

x.^5

0.200566322469280

x.^6

-0.000000000000000

x.^7

1.613431596510340

x.^8

Sumatorias de y

1.0e+002 *

0.145714885054841
0.112025559503709

y
x*y

0.012935635455847

y*x.^2

1.145390165764610

y*x.^3

-1.280641071645164

y*x.^4

Ajuste de Polinomio a grado 5


mc2
Elija los

valores de xlinspace(-3,3,12)

x =
Columns 1 through 8
-3.000000000000000 -2.454545454545455
0.272727272727273
0.818181818181818

-1.909090909090909

-1.363636363636364

2.454545454545454

3.000000000000000

-0.818181818181818

-0.272727272727273

2.993596785794432

2.733489951018636

Columns 9 through 12
1.363636363636363

1.909090909090909

Ingrese las parejas de los datos de

x3*sin(exp(-x/2))

y =
Columns 1 through 8

-2.920519778316971 -0.801116507633982
2.297864622225752
1.849415392302503

1.552952540062045

2.755325114338886

0.866737862471463

0.663849792906007

Columns 9 through 12
1.453251190259060

1.126641540056258

elija el grado del polinomio5


O =
1.0e+005 *

0.000120000000000

-0.000000000000000

0.000425454545455

-0.000000000000000

0.002689857250188

-0.000000000000000

-0.000000000000000

0.000425454545455

-0.000000000000000

0.002689857250188

-0.000000000000000

0.020056632246928

0.000425454545455

-0.000000000000000

0.002689857250188

-0.000000000000000

0.020056632246928

-0.000000000000000

-0.000000000000000

0.002689857250188

-0.000000000000000

0.020056632246928

-0.000000000000000

0.161343159651034

0.002689857250188

-0.000000000000000

0.020056632246928

-0.000000000000000

0.161343159651034

-0.000000000000000

-0.000000000000000

0.020056632246928

-0.000000000000000

0.161343159651034

-0.000000000000000

1.353048857058631

bb =

1.0e+003 *

0.014571488505484
0.011202555950371
0.001293563545585
0.114539016576461
-0.128064107164516
1.002229547669045

sistema =
Sistema de ecuaciones. (lo tuve que reducir de tamao para

que pudiera presentarse bien la tabla)

1.0e+005 *
La ltima columna es la de los trminos independientes
0.000120000000000

-0.000000000000000

0.000425454545455

-0.000000000000000

0.002689857250188

-0.000000000000000

0.000145714885055

-0.000000000000000

0.000425454545455

-0.000000000000000

0.002689857250188

-0.000000000000000

0.020056632246928

0.000112025559504

0.000425454545455

-0.000000000000000

0.002689857250188

-0.000000000000000

0.020056632246928

-0.000000000000000

0.000012935635456

-0.000000000000000

0.002689857250188

-0.000000000000000

0.020056632246928

-0.000000000000000

0.161343159651034

0.001145390165765

0.002689857250188

-0.000000000000000

0.020056632246928

-0.000000000000000

0.161343159651034

-0.000000000000000

-0.001280641071645

-0.000000000000000

0.020056632246928

-0.000000000000000

0.161343159651034

-0.000000000000000

1.353048857058631

0.010022295476690

Solucion
sol =

2.649071560543261
-0.951161669565782
-0.351650193548362
0.286206717849582
-0.008388002357245
-0.012621939549015

Polinomio y2 = sol(1)+ x*sol(2) +sol(3)*x.^2 +sol(4)*x.^3 +sol(5)*x.^4 +sol(6)*x.^5


= Polinomio
2.64907156054326 -0.951161669565782x -0.351650193548362x.^2
0.286206717849582*x.^3 -0.008388002357245*x.^4 -0.012621939549015*x.^5
x*sol(2) +sol(3)*x.^2 +sol(4)*x.^3 +sol(5)*x.^4 +sol(6)*x.^5

Sumatorias de

1.0e+005 *
-0.000000000000000

0.000425454545455

x.^2

-0.000000000000000

x.^3

0.002689857250188

x.^4

-0.000000000000000

x.^5

0.020056632246928 x.^6
-0.000000000000000 x.^7
0.161343159651034

x.^8

-0.000000000000000

x.^9

1.353048857058631

x.^10

Sumatorias de yx
1.0e+003 *

0.014571488505484

0.011202555950371

xy

0.001293563545585

x.^2y

0.114539016576461

x.^3y

-0.128064107164516

x.^4y

1.002229547669045

x.^5y

>> [x;y;y2]'
Tabla de datos
X

y ajustada

-3.000000000000000

-2.920519778316971

-3.002173435159545

-2.454545454545455

-0.801116507633982

-0.547252376457052

-1.909090909090909

1.552952540062045

1.400546187945299

-1.363636363636364

2.755325114338886

2.596994743133328

-0.818181818181818

2.993596785794432

3.036003631973320

-0.272727272727273

2.733489951018636

2.876490281431784

0.272727272727273

2.297864622225752

2.369248428895213

0.818181818181818

1.849415392302503

1.783817348489831

1.363636363636363

1.453251190259060

1.335351077401359

1.909090909090909

1.126641540056258

1.111487642194758

2.454545454545454

0.866737862471463

0.999218285133998

3.000000000000000

0.663849792906007

0.611756690501803

MI PROGRAMA QUE US

mc2

Hecho por Oscar Enrique Urea Mrquez


% Nos entrega
% x.^3 etc

desde le termino independiente hasta

...

x.^2

clear,
x=input('Elija los valores de x')
A= length(x);
y=input('Ingrese las parejas de los datos de x')
m=input('elija el grado del polinomio');
gms=m*2; % es el grado maximo de la sumatoria
if m==1
gms=2;
for n=1:gms
sx(n)=sum(x.^n); % Es la sumatoria de
x del grado n
end
O=[A sx(1);sx(1) sx(2)]
for l=0:m
b(l+1) = sum(y.*x.^l);
end
bb=b'
sistema=[O bb]
sol=O\bb
else
for n=1:gms
sx(n)=sum(x.^n);

% Es la sumatoria de

x del grado n

end
B=sx; % es el vector de sumatorias de x grado n
for j=1:m+1
if j==1
O=[A B(1:m)]; % haciendo exclusion en el primer renglon, y concatenamos el numero de
datos con las sumatorias
else
O(j,:)=B((j-1):(j-1)+(m)); % j es el numero del renglon, en el renglon j ponemos los
ciertos valores del vector B de sumatorias
end
end
% format rational
O

for l=0:m
b(l+1) = sum(y.*x.^l);
end
bb=b'
sistema=[O bb]
sol=O\bb
end
%sy=sum(y);
% ym= sy/A; % y media
%t1 = sum((y-ym).^2);
%t2 = sum((y-yecn).^2); % el y ecn es el que obtenemos de nuestro metodo, el y
valores tabulados
%r =sqrt((t1-t2)./t1)*100;
%fprintf('\nr porcentual de orden 5 = %8.2f\n',r)

normal son los

%coef=[' 1 ' ' x ' ' x.^2 ' ' x.^3 ' ' x.^4 ' ' x.^5 ' ' x.^6 ' ' x.^7 ' ' x.^8 ']
%repcon=1
%for l=0:m
%repre([repcon repcon+1])= [sol(l+1) coef(l+1)];
%repcon=repcon+2;
%end
%format rational
%repre

DESPUES DE USAR EL PROGRAMA, PARA VER LAS VARIABLES ASIGNADAS


b

Te presenta el vector de sumatorias de y*x.^n desde n=0 hasta el grado de polinomio de ajuste

sx Te presenta el vector de sumatorias de x.^n desde n=1 hasta hasta el grado de ajuste*2
sistema te presenta el sistema de ecuaciones con todo y trminos independientes (en la ltima columna)
sol Te presenta el vector solucin del sistema de ecuaciones
[x;y] tabla de datos x y iniciales

MI CODIGO EN MATLAB

INTACTO

x=linspace(-3,3,12)

x =

Columns 1 through 8

-3.000000000000000

-2.454545454545455

-1.909090909090909

-1.363636363636364

1.909090909090909

2.454545454545454

3.000000000000000

-0.801116507633982

1.552952540062045

2.755325114338886

1.126641540056258

0.866737862471463

0.663849792906007

-2.454545454545455

-1.909090909090909

-1.363636363636364

1.909090909090909

2.454545454545454

3.000000000000000

-0.818181818181818

-0.272727272727273

0.272727272727273

0.818181818181818

2.993596785794432

2.733489951018636

2.297864622225752

1.849415392302503

-0.818181818181818

-0.272727272727273

0.272727272727273

0.818181818181818

Columns 9 through 12

1.363636363636363

>> y = 3*sin(exp(-x/2))

y =

Columns 1 through 8

-2.920519778316971

Columns 9 through 12

1.453251190259060

>> format long


>> mc2
Elija los

valores de xlinspace(-3,3,12)

x =

Columns 1 through 8

-3.000000000000000

Columns 9 through 12

1.363636363636363

Ingrese las parejas de los datos de

x3*sin(exp(-x/2))

y =

Columns 1 through 8

-2.920519778316971

-0.801116507633982

1.552952540062045

2.755325114338886

1.126641540056258

0.866737862471463

0.663849792906007

2.993596785794432

Columns 9 through 12

1.453251190259060

elija el grado del polinomio4

O =

12

468/11

468/11

18829/70

18829/70

18829/70

468/11

*
18829/70
*
196555/98

18829/70
*
196555/98
*

196555/98

306552/19

12

468/11

18829/70

468/11

468/11

18829/70

18829/70

bb =

34753/2385
6139/548
824/637
16150/141
-9989/78

sistema =

18829/70

sol =

196555/98

18829/70
*
196555/98
*

*
196555/98
*
306552/19

34753/2385
6139/548
824/637
16150/141
-9989/78

2.733489951018636

2.297864622225752

1.849415392302503

2710/1023
-705/1097
-2099/5969
977/6818
-78/9299

Elija los

valores de xlinspace(-3,3,12)

x =

Columns 1 through 10

-3

-27/11

-21/11

-15/11

-9/11

-3/11

3/11

9/11

15/11

21/11

715/492

1201/1066

Columns 11 through 12

27/11

Ingrese las parejas de los datos de

x3*sin (exp(-x/2))

y =

Columns 1 through 10

-2021/692

-1148/1433

1657/1067

4786/1737

2805/937

Columns 11 through 12

813/938

707/1065

elija el grado del polinomio4

O =

12

468/11

468/11

18829/70

18829/70

18829/70

bb =

468/11

*
196555/98

*
18829/70
*
196555/98
*

18829/70
*
196555/98
*
306552/19

1159/424

6349/2763

1265/684

34753/2385
6139/548
824/637
16150/141
-9989/78

sistema =

12

468/11

468/11

18829/70

18829/70

18829/70

468/11

196555/98

*
18829/70
*
196555/98
*

18829/70
*

34753/2385
6139/548

196555/98
*
306552/19

824/637
16150/141
-9989/78

sol =

2710/1023
-705/1097
-2099/5969
977/6818
-78/9299

>> format long


>> mc2
Elija los

valores de xlinspace(-3,3,12)

x =

Columns 1 through 8

-3.000000000000000

-2.454545454545455

-1.909090909090909

-1.363636363636364

1.909090909090909

2.454545454545454

3.000000000000000

Columns 9 through 12

1.363636363636363

Ingrese las parejas de los datos de

y =

x3*sin (exp(-x/2))

-0.818181818181818

-0.272727272727273

0.272727272727273

0.818181818181818

Columns 1 through 8

-2.920519778316971

-0.801116507633982

1.552952540062045

2.755325114338886

1.126641540056258

0.866737862471463

0.663849792906007

2.993596785794432

2.733489951018636

Columns 9 through 12

1.453251190259060

elija el grado del polinomio4

O =

1.0e+004 *

0.001200000000000

-0.000000000000000

0.004254545454545

-0.000000000000000

0.026898572501878

-0.000000000000000

0.004254545454545

-0.000000000000000

0.026898572501878

-0.000000000000000

0.004254545454545

-0.000000000000000

0.026898572501878

-0.000000000000000

0.200566322469280

-0.000000000000000

0.026898572501878

-0.000000000000000

0.200566322469280

-0.000000000000000

0.026898572501878

-0.000000000000000

0.200566322469280

-0.000000000000000

1.613431596510340

0.001200000000000

-0.000000000000000

0.004254545454545

-0.000000000000000

0.026898572501878

0.001457148850548

-0.000000000000000

0.004254545454545

-0.000000000000000

0.026898572501878

-0.000000000000000

0.001120255595037

0.004254545454545

-0.000000000000000

0.026898572501878

-0.000000000000000

0.200566322469280

0.000129356354558

-0.000000000000000

0.026898572501878

-0.000000000000000

0.200566322469280

-0.000000000000000

0.011453901657646

0.026898572501878

-0.000000000000000

0.200566322469280

-0.000000000000000

1.613431596510340

-0.012806410716452

bb =

1.0e+002 *

0.145714885054841
0.112025559503709
0.012935635455847
1.145390165764610
-1.280641071645164

sistema =

1.0e+004 *

2.297864622225752

1.849415392302503

sol =

2.649071560543259
-0.642661673276221
-0.351650193548361
0.143297154360733
-0.008388002357245

>> plot(x,y,'og')
>> hold on
>> y1=sol(1) +x*sol(2) +x.^2*sol(3) +x.^3*sol(4) +x.^4*sol(5)

y1 =

Columns 1 through 8

-3.136246520239999

-0.315671593136276

1.485865423905590

2.479172941092940

1.026168406234469

0.767637501813223

0.745829775582253

Columns 9 through 12

1.453172879441748

>> hold on
>> plot(x,y1,'r')
>> gtext('Ajuste de polinimio

grado 4')

>> [x;y]'

ans =

-3.000000000000000

-2.920519778316971

-2.454545454545455

-0.801116507633982

-1.909090909090909

1.552952540062045

-1.363636363636364

2.755325114338886

-0.818181818181818

2.993596785794432

-0.272727272727273

2.733489951018636

0.272727272727273

2.297864622225752

0.818181818181818

1.849415392302503

1.363636363636363

1.453251190259060

1.909090909090909

1.126641540056258

2.454545454545454

0.866737862471463

3.000000000000000

0.663849792906007

>> [x;y;y1]'

2.857239518532725

2.795233866231512

2.450504844095480

1.962581461930424

ans =

-3.000000000000000

-2.920519778316971

-3.136246520239999

-2.454545454545455

-0.801116507633982

-0.315671593136276

-1.909090909090909

1.552952540062045

1.485865423905590

-1.363636363636364

2.755325114338886

2.479172941092940

-0.818181818181818

2.993596785794432

2.857239518532725

-0.272727272727273

2.733489951018636

2.795233866231512

0.272727272727273

2.297864622225752

2.450504844095480

0.818181818181818

1.849415392302503

1.962581461930424

1.363636363636363

1.453251190259060

1.453172879441748

1.909090909090909

1.126641540056258

1.026168406234469

2.454545454545454

0.866737862471463

0.767637501813223

3.000000000000000

0.663849792906007

0.745829775582253

0.004254545454545

-0.000000000000000

>> sx

sx =

1.0e+004 *

-0.000000000000000

0.026898572501878

-0.000000000000000

0.200566322469280

>> format rational


>> sx

sx =

468/11

>> sx'

ans =

-1/562949953421312
468/11
-1/140737488355328
18829/70
-1/17592186044416
196555/98
-1/1099511627776
306552/19

18829/70

196555/98

306552/19

-0.000000000000000

1.613431596510340

>> format long


>> sx'

ans =

1.0e+004 *

-0.000000000000000
0.004254545454545
-0.000000000000000
0.026898572501878
-0.000000000000000
0.200566322469280
-0.000000000000000
1.613431596510340

>> b

b =

1.0e+002 *

0.145714885054841

0.112025559503709

>> b'

ans =

1.0e+002 *

0.145714885054841
0.112025559503709
0.012935635455847
1.145390165764610
-1.280641071645164

Elija los

valores de xlinspace(-3,3,12)

x =

Columns 1 through 8

0.012935635455847

1.145390165764610

-1.280641071645164

-3.000000000000000

-2.454545454545455

-1.909090909090909

-1.363636363636364

1.909090909090909

2.454545454545454

3.000000000000000

-0.818181818181818

-0.272727272727273

0.272727272727273

0.818181818181818

2.993596785794432

2.733489951018636

2.297864622225752

1.849415392302503

Columns 9 through 12

1.363636363636363

Ingrese las parejas de los datos de

x3*sin(exp(-x/2))

y =

Columns 1 through 8

-2.920519778316971

-0.801116507633982

1.552952540062045

2.755325114338886

1.126641540056258

0.866737862471463

0.663849792906007

Columns 9 through 12

1.453251190259060

elija el grado del polinomio5

O =

1.0e+005 *

0.000120000000000

-0.000000000000000

0.000425454545455

-0.000000000000000

0.002689857250188

-0.000000000000000

-0.000000000000000

0.000425454545455

-0.000000000000000

0.002689857250188

-0.000000000000000

0.020056632246928

0.000425454545455

-0.000000000000000

0.002689857250188

-0.000000000000000

0.020056632246928

-0.000000000000000

-0.000000000000000

0.002689857250188

-0.000000000000000

0.020056632246928

-0.000000000000000

0.161343159651034

0.002689857250188

-0.000000000000000

0.020056632246928

-0.000000000000000

0.161343159651034

-0.000000000000000

-0.000000000000000

0.020056632246928

-0.000000000000000

0.161343159651034

-0.000000000000000

1.353048857058631

bb =

1.0e+003 *

0.014571488505484
0.011202555950371
0.001293563545585
0.114539016576461
-0.128064107164516
1.002229547669045

sistema =

1.0e+005 *

0.000120000000000

-0.000000000000000

0.000425454545455

-0.000000000000000

0.002689857250188

-0.000000000000000

0.000145714885055

-0.000000000000000

0.000425454545455

-0.000000000000000

0.002689857250188

-0.000000000000000

0.020056632246928

0.000112025559504

0.000425454545455

-0.000000000000000

0.002689857250188

-0.000000000000000

0.020056632246928

-0.000000000000000

0.000012935635456

-0.000000000000000

0.002689857250188

-0.000000000000000

0.020056632246928

-0.000000000000000

0.161343159651034

0.001145390165765

0.002689857250188

-0.000000000000000

0.020056632246928

-0.000000000000000

0.161343159651034

-0.000000000000000

-0.001280641071645

-0.000000000000000

0.020056632246928

-0.000000000000000

0.161343159651034

-0.000000000000000

1.353048857058631

0.010022295476690

sol =

2.649071560543261
-0.951161669565782
-0.351650193548362
0.286206717849582
-0.008388002357245
-0.012621939549015

>>
1.0e+002 *

0.145714885054841
0.112025559503709
0.012935635455847
1.145390165764610
-1.280641071645164
???

1.0e+002 *
|

Error: Expression or statement is incomplete or incorrect.

>> ,c2
??? Undefined function or variable 'c2'.

>> mc2
Elija los

valores de xlinspace(-3,3,12)

x =

Columns 1 through 8

-3.000000000000000

-2.454545454545455

-1.909090909090909

-1.363636363636364

1.909090909090909

2.454545454545454

3.000000000000000

-0.818181818181818

-0.272727272727273

0.272727272727273

0.818181818181818

2.993596785794432

2.733489951018636

2.297864622225752

1.849415392302503

Columns 9 through 12

1.363636363636363

Ingrese las parejas de los datos de

x3*sin(exp(-x/2))

y =

Columns 1 through 8

-2.920519778316971

-0.801116507633982

1.552952540062045

2.755325114338886

1.126641540056258

0.866737862471463

0.663849792906007

Columns 9 through 12

1.453251190259060

elija el grado del polinomio5

O =

1.0e+005 *

0.000120000000000

-0.000000000000000

0.000425454545455

-0.000000000000000

0.002689857250188

-0.000000000000000

-0.000000000000000

0.000425454545455

-0.000000000000000

0.002689857250188

-0.000000000000000

0.020056632246928

0.000425454545455

-0.000000000000000

0.002689857250188

-0.000000000000000

0.020056632246928

-0.000000000000000

-0.000000000000000

0.002689857250188

-0.000000000000000

0.020056632246928

-0.000000000000000

0.161343159651034

0.002689857250188

-0.000000000000000

0.020056632246928

-0.000000000000000

0.161343159651034

-0.000000000000000

-0.000000000000000

0.020056632246928

-0.000000000000000

0.161343159651034

-0.000000000000000

1.353048857058631

bb =

1.0e+003 *

0.014571488505484
0.011202555950371
0.001293563545585
0.114539016576461
-0.128064107164516
1.002229547669045

sistema =

1.0e+005 *

0.000120000000000

-0.000000000000000

0.000425454545455

-0.000000000000000

0.002689857250188

-0.000000000000000

0.000145714885055

-0.000000000000000

0.000425454545455

-0.000000000000000

0.002689857250188

-0.000000000000000

0.020056632246928

0.000112025559504

0.000425454545455

-0.000000000000000

0.002689857250188

-0.000000000000000

0.020056632246928

-0.000000000000000

0.000012935635456

-0.000000000000000

0.002689857250188

-0.000000000000000

0.020056632246928

-0.000000000000000

0.161343159651034

0.001145390165765

0.002689857250188

-0.000000000000000

0.020056632246928

-0.000000000000000

0.161343159651034

-0.000000000000000

-0.001280641071645

-0.000000000000000

0.020056632246928

-0.000000000000000

0.161343159651034

-0.000000000000000

1.353048857058631

0.010022295476690

3.036003631973320

2.876490281431784

2.369248428895213

1.783817348489831

3.036003631973320

2.876490281431784

2.369248428895213

1.783817348489831

sol =

2.649071560543261
-0.951161669565782
-0.351650193548362
0.286206717849582
-0.008388002357245
-0.012621939549015

>> sol(1)+ x*sol(2) +sol(3)*x.^2 +sol(4)*x.^3 +sol(5)*x.^4 +sol(6)*x.^5

ans =

Columns 1 through 8

-3.002173435159545

-0.547252376457052

1.400546187945299

2.596994743133328

1.111487642194758

0.999218285133998

0.611756690501803

Columns 9 through 12

1.335351077401359

>> y2 =sol(1)+ x*sol(2) +sol(3)*x.^2 +sol(4)*x.^3 +sol(5)*x.^4 +sol(6)*x.^5

y2 =

Columns 1 through 8

-3.002173435159545

-0.547252376457052

1.400546187945299

2.596994743133328

Columns 9 through 12

1.335351077401359

1.111487642194758

0.999218285133998

0.611756690501803

>> plot(x,y,'og')
>> hold on
>> plot(x,y2,'m')
>> gtext('-------Ajuste de polinimio

grado 5-------------')

>> sx

sx =

1.0e+005 *

Columns 1 through 8

-0.000000000000000

0.000425454545455

Columns 9 through 10

-0.000000000000000

>> sx'

ans =

1.0e+005 *

-0.000000000000000
0.000425454545455
-0.000000000000000
0.002689857250188
-0.000000000000000
0.020056632246928
-0.000000000000000
0.161343159651034
-0.000000000000000
1.353048857058631

>> b

b =

1.353048857058631

-0.000000000000000

0.002689857250188

-0.000000000000000

0.020056632246928

-0.000000000000000

0.161343159651034

1.0e+003 *

0.014571488505484

0.011202555950371

0.001293563545585

0.114539016576461

-0.128064107164516

1.002229547669045

-2.454545454545455

-1.909090909090909

-1.363636363636364

-0.818181818181818

-0.272727272727273

0.272727272727273

0.818181818181818

1.909090909090909

2.454545454545454

3.000000000000000

-2.920519778316971

-0.801116507633982

1.552952540062045

2.755325114338886

2.297864622225752

1.849415392302503

1.453251190259060

1.126641540056258

0.866737862471463

0.663849792906007

1.400546187945299

2.596994743133328

3.036003631973320

2.876490281431784

2.369248428895213

1.783817348489831

0.999218285133998

0.611756690501803

>> b'

ans =

1.0e+003 *

0.014571488505484
0.011202555950371
0.001293563545585
0.114539016576461
-0.128064107164516
1.002229547669045

>> [x,y,y2]

ans =

Columns 1 through 8

-3.000000000000000

Columns 9 through 16

1.363636363636363

Columns 17 through 24

2.993596785794432

2.733489951018636

Columns 25 through 32

-3.002173435159545

-0.547252376457052

Columns 33 through 36

1.335351077401359

>> [x;y;y2]'

1.111487642194758

ans =

-3.000000000000000

-2.920519778316971

-3.002173435159545

-2.454545454545455

-0.801116507633982

-0.547252376457052

-1.909090909090909

1.552952540062045

1.400546187945299

-1.363636363636364

2.755325114338886

2.596994743133328

-0.818181818181818

2.993596785794432

3.036003631973320

-0.272727272727273

2.733489951018636

2.876490281431784

0.272727272727273

2.297864622225752

2.369248428895213

0.818181818181818

1.849415392302503

1.783817348489831

1.363636363636363

1.453251190259060

1.335351077401359

1.909090909090909

1.126641540056258

1.111487642194758

2.454545454545454

0.866737862471463

0.999218285133998

3.000000000000000

0.663849792906007

0.611756690501803