Você está na página 1de 11

Ajustar a un polinomio de grado 3

i x y
0 0 1
1
2
7
14
8
11
=mmult(...,
3 21 10 =minversa(
4
5
28
35
6
-1 Ctrl+Shift+E
6 42 -6
7 49 -9
8 56 -5
9 63 3

X 3 2 1 0 Xt
0 0 0 1 0
343 49 7 1 0
2744 196 14 1 0
9261 441 21 1 1
21952 784 28 1
42875 1225 35 1
74088 1764 42 1
117649 2401 49 1
175616 3136 56 1
250047 3969 63 1

Xt*X (Xt*X)^-1
115108369845 2030705775 36814533 694575 2.751832347E-09
2030705775 36814533 694575 13965 -0.00000026
36814533 694575 13965 315 6.216114088E-06
694575 13965 315 10 -2.37857381E-05

a
0.0008755417
-0.0830479045
1.7998390498
0.2685314685

P(x)=0.000876x^3-0.08305x^2+1.7998x+0.26853

Chart Title
15

11
f(x)
10
= 0.0008755417x^3 - 0.0830479045x^2
10
+ 1.7998390498x + 0.2685314685
R² = 0.9878097446
8

6
5
15

11
f(x)
10
= 0.0008755417x^3 - 0.0830479045x^2
10
+ 1.7998390498x + 0.2685314685
R² = 0.9878097446
8

6
5

1
0
0 10 20 30 -1 40 50 60 70

-5 -5
-6

-9
-10
=mmult(...,...)
=minversa(...)
Ctrl+Shift+Enter

343 2744 9261 21952 42875 74088 117649


49 196 441 784 1225 1764 2401
7 14 21 28 35 42 49
1 1 1 1 1 1 1

-0.00000026 6.216114088E-06 -2.37857381E-05


2.536336356E-05 -0.000637118 0.0027115741
-0.000637118 0.0174197496 -0.0907425907
0.0027115741 -0.0907425907 0.8237762238
175616 250047
3136 3969
56 63
1 1
D=[0 1
7 8
14 11
21 10
28 6
35 -1
42 -6
49 -9
56 -5
63 3]
x=D(:,1);y=D(:,2)
X=[x.^3 x.^2 x.^1 ones(10,1)]
a=inv(X'*X)*X'*y

%Coeficiente de determinacion (Calidad de


ajuste)
yp=polyval(a,x);
ym = mean(y);
st = sum((y-ym).^2);
sr = sum((y-yp).^2);
r2 = 1 - sr/st

%a=polyfit(x,y,3)
Ajustar a un polinomio de grado 4
x y
1 0 0
2 6 6 Chart Title
3 11 9 15
4 17 10
5 23 8 10
6 29 3 f(x) = - 2.07944911225905E-06x^4 + 0.0010939579x^3 - 0.0889467102x^2 + 1.8086945366x - 0.748694563

7 34 -3
5
8 40 -7
9 46 -9
10 51 -9 0
0 10 20 30 40 50 60 70
11 57 -4
12 63 0 -5

-10
86945366x - 0.748694563

70
Ajuste a una funcion potencia

x y Lnx Lny X
1 1 2.2 0 0.8093846 0 1
2 1.4737 15.6 0.38777625 2.74733686 0.38777625 1
3 1.9474 180.4 0.66649515 5.19537232 0.66649515 1
4 2.4211 451.3 0.88422198 6.1121235 0.88422198 1
5 2.8947 3326.3 1.06288148 8.10960085 1.06288148 1
6 3.3684 8821.8 1.21443785 9.08497589 1.21443785 1
7 3.8421 38243.7 1.34601909 10.5517336 1.34601909 1
8 4.3158 74369.3 1.46228271 11.2167984 1.46228271 1
9 4.7895 110824.7 1.56642602 11.6157046 1.56642602 1
10 5.2632 319646.5 1.66073921 12.674971 1.66073921 1
11 5.7368 228304.0 1.74690156 12.3384332 1.74690156 1
12 6.2105 604760.7 1.82624141 13.3125882 1.82624141 1
13 6.6842 1748440.9 1.89974653 14.374235 1.89974653 1
14 7.1579 2801723.9 1.96821664 14.8457455 1.96821664 1
15 7.6316 3680508.0 2.03229752 15.1185613 2.03229752 1
16 8.1053 5106793.4 2.09251817 15.4460823 2.09251817 1
17 8.5789 5436451.7 2.1493057 15.5086372 2.1493057 1
18 9.0526 14711846.9 2.20305201 16.5041636 2.20305201 1
19 9.5263 7739207.4 2.25405639 15.8618098 2.25405639 1
20 10 24803463.3 2.30258509 17.0264939 2.30258509 1
Xt
0 0.38778 0.666 0.884 1.063 1.214 1.346 1.462 1.566 1.661 1.747 1.826 1.9 1.968 2.032
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

Xt*X Xt*X^-1 a
55.38 30.7262 0.122 -0.19 7.164 y=7.16x+0.42
30.73 20 -0.19 0.339 0.416

b= 7.16445
A=Ln(a)=0.42
a= 1.51577
y=1.51577*x^7.16445
2.093 2.149 2.203 2.254 2.303
1 1 1 1 1
Ajuste a una funcion potencia

x y
1 1 9.2
2 1.4737 15.6
3 1.9474 27.1
4 2.4211 61.7
5 2.8947 63.9
6 3.3684 165.9
7 3.8421 188.7
8 4.3158 351.7
9 4.7895 476.6
10 5.2632 504.4
11 5.7368 834.1
12 6.2105 991.0
13 6.6842 1430.4
14 7.1579 1564.0
15 7.6316 2375.8
16 8.1053 2939.1
17 8.5789 3225.4

Você também pode gostar