Upload
vitor-alves
View
214
Download
0
Embed Size (px)
DESCRIPTION
cccdfg
Citation preview
Método dos mínimos quadrados - Cálculo Numérico – Prof. Dr. Cláudio Sérgio Sartori.
1
2 2 4 6 8x
5
5
10
15
20
25
y
2 2 4 6 8 10 12x
5
10
y
Método dos Mínimos Quadrados: Aproximação : Caso Domínio Discreto:
Para aproximarmos uma função f tabelada em n pontos distintos x1,x2,x3,...,xn por uma função g da forma:
1
( )m
k k
k
a g x
precisamos determinar os valores a0,a1,...,ak que minimizam a
soma dos quadrados dos resíduos M(a0,a1,...,ak) nos pontos x1,x2,x3,...,xn. :
2
0 1
1
( , ,.., ) ( ) ( )n
n i i
i
M a a a f x g x
2
1 1 2 2
1
( ) ( ) ( ) ( )n
i m m
i
f x a g x a g x a g x
E precisamos obter a0,a1,...,ak tal que:
0),...,( 0
l
m
a
aaM
Chegamos num sistema denominado sistema normal:
1 1 1 2 1 3 1 11
2 1 2 2 2 3 2 22
3 1 3 2 3 3 3 33
1 2 3
m
m
m
mm m m m m m
g g g g g g g g g ya
g g g g g g g g g ya
g g g g g g g g g ya
ag g g g g g g g g y
Propriedade:
1
n
i j i k j k
k
g g g x g x
i j j ig g g g
1
n
i i k k
k
g y g x y x
Regressão linear: y b x a
2
1 1 1
1 1
N N N
i i i i
i i i
N N
i i
i i
x x x yb
ax N y
1 1
1
2
1 1
1
N N
i i i
i i
N
i
i
N N
i i
i i
N
i
i
x y x
y N
b
x x
x N
1 1 1
2
2
1 1
N N N
i i i i
i i i
N N
i i
i i
N x y y x
b
N x x
2
1 1
1 1
2
1 1
1
N N
i i i
i i
N N
i i
i i
N N
i i
i i
N
i
i
x x y
x y
a
x x
x N
2
1 1 1 1
2
2
1 1
N N N N
i i i i i
i i i i
N N
i i
i i
x y x x y
a
N x x
Exempo 1 - Ajuste os pontos por uma reta:
y a b x
Estime o valor para x = 7.
x y
0 2.4
1 2.1
2 3.2
3 5.6
4 9.3
5 14.6
6 21.9
Calcule em seguida y ( x = 3.5)
Respostas:
3.2 1.15714y x
2
1 1 1
1 1
91 21 266.9
21 7 59.1
N N N
i i i i
i i i
N N
i i
i i
x x x yb b
a ax N y
Exemplo 2 - Ajuste os pontos da tabela abaixo por uma reta:
x F(x)
-2,00 -3,00
1,50 2,57
3,45 3,50
4,55 5,30
8,98 9,00
1.06806 0.0463354y x
Método dos mínimos quadrados - Cálculo Numérico – Prof. Dr. Cláudio Sérgio Sartori.
2
Pontos e Ajustes
x
876543210-1-2
y
10
9
8
7
6
5
4
3
2
1
0
-1
-2
-3
-4
Pontos 1gfedcbPontos 2gfedcbPontos 3gfedcb-0.059946518344858 . x^2+1.65000858748706 . x^1gfedcbAjuste 2gfedcbAjuste 3gfedcb
Pontos e Ajustes
x
876543210-1-2
y
32
30
28
26
24
22
20
18
16
14
12
10
8
6
4
2
0
-2
Exemplo 3 – Monte a forma matricial do sistema normal
quando precisamos fazer o ajuste de N pontos dados (xi, yi) pela função:
(a) 2( )f x a x b x .
(b) 3( ) xf x a x b e c senx
Solução:
(a)4 3 2
1 1 1
3 2
1 1 1
N N N
i i i i
i i i
N N N
i i i i
i i i
x x x ya
bx x x y
(b)
6 3 3 3
1 1 1 1
23
1 1 1 1
3 2
1 1 1 1
i
i i i i
i
N N N Nx
i i i i i i
i i i i
N N N Nx x x x
i i i
i i i i
N N N Nx
i i i i i i
i i i i
x x e x senx x y
a
x e e e senx b e y
c
x senx e senx sen x senx y
Exemplo 4 – Fazer o ajuste de N pontos dados (xi, yi) pela
funções indicadas:
i x F(x)
1 -2.5 -3.3
2 1.5 2.6
3 3.6 5.4
4 4.8 7.9
5 8.9 9.4
(a) 2( )f x a x b x
7017.152 849.967 981.799
849.967 123.71 153.17
a
b
2( ) -0.05994651 1.650008f x x x
(b) 3( ) xf x a x b e c senx
511644.19 5183973.50 235.107 7812.665
5183973.5 53773960.28 3540.65 70089.45
235.107 3540.65 2.79 0.98126
a
b
c
3( ) 0.1100394 -0.00946 2.38031xf x x e senx
Exercícios
1. Ajuste os pontos por uma reta:
y a b x
Estime o valor para x = 7.
x y
0 2.4
1 2.1
2 3.2
3 5.6
4 9.3
5 14.6
6 21.9
Calcule em seguida y ( x = 3.5)
2. – Ajuste os pontos da tabela abaixo por uma reta:
x F(x)
-2,00 -3,00
1,50 2,57
3,45 3,50
4,55 5,30
8,98 9,00
3. A tabela dá a distância de parada d(em pés) de um
automóvel viajando a uma velocidade v (milhas por hora no instante em que um perigo é percebido.
(a) Represente graficamente d contra v.
(b) Ajuste por uma parábola dos mínimos quadrados:
2d a b v c v os dados.
(c) Estime d quando v = 45 milhas por hora.
v(mi/h) d(mi)
20 54
30 90
40 138
50 206
60 292
70 396
4. O número y de bactérias por unidade de volume presente
em uma cultura após x horas é dado na tabela. (a) Represente graficamente em papel com escala semi-
logarítmica, com escala logarítmica usada para y e escala normal para x.
(b) Ajuste uma curva dos mínimos quadrados da forma
xy a b .
(c) Estime o valor de y quando x = 7.
Método dos mínimos quadrados - Cálculo Numérico – Prof. Dr. Cláudio Sérgio Sartori.
3
x(h) y(número de
bactérias por unidade de
volume)
0 32
1 47
2 65
3 92
4 132
5 190
6 275
Procedimento:xy a b
log log xy a b
log log log xy a b
log log logy a x b
Y A B x
log
log
log
Y y
A a
B b
x(h) y(número de bactérias por
unidade de
volume)
Y=logy
0 32
1 47
2 65
3 92
4 132
5 190
6 275
Faça a regressão linear dos pontos (x, log y)
10log 10Aa A a
10log 10Bb B b
xy a b
5. Ajuste os pontos da tabela abaixo por uma reta:
x F(x)
2.55 1.00
3.54 2.57
4.02 3.50
5.54 5.30
6.08 8.66
6. Ajuste os pontos da tabela abaixo por uma reta:
x F(x)
2,55 -2,00
3,54 3,57
4,02 5,50
6,54 6,30
8,08 8,66
7. Ajuste os pontos da tabela abaixo por uma parábola do tipo ax2 + bx + c:
x F(x)
-3 -2
-1 1
2.54 2
3.5 4.3
5 5
7 8
10 9.5
4 3 2 2
1 1 1 1
3 2
1 1 1 1
2
1 1 1
N N N N
i i i i i
i i i i
N N N N
i i i i i
i i i i
N N N
i i i
i i i
x x x x y
a
x x x b x y
c
x x N y