Date post: | 30-Dec-2015 |
Category: |
Documents |
Upload: | rachel-allison |
View: | 215 times |
Download: | 0 times |
1
CMLab
Some basic Applications of Digital filters :
• Least-square fitting of polynomials
Given M data points (tm, um), m=1,2,…,M wish to fit (approximate) these data, in some sense, by a polynomial u=u(t) of degree N where M N+1≧
Principle of least square :
the sum of the squares of the residuals is the least
2
CMLab
Ex: consider a set of 5 equally spaced data points.
tm=m for m=-2, -1, 0, 1, 2
um unspecified
fit the above data by a straight line u=A+Bt
in least-square sense.
1 1, 1, 1, 1,5
1 : windowrunning
average moving : 5
1
equation normal
0,
0,
,min
2
2
2
2
2
mmnn
mm
uu
B
BAFA
BAF
BmAuBAF
3
CMLab
From the frequency point of view :
S’pose the input function is one of the eigenfunctions in the complex form eiwt of frequency w.
Since the system is linear, the same function will emerge at the output except that it is multiplied by its eigenvalue H(w).
4
CMLab
2sin5
25sin
2cos2cos215
1
15
1 22
w
w
ww
eeeewH iwiwiwiw
2
212
1
sin
sin
12
1
...12
1
w
N
iNwwNiiNw
w
N
eeeN
wH
In general :
: transfer function
5
CMLab
the more terms used , the more rapid are the wiggles of H(w), and the more the envelope of the wiggles is squeezed toward the frequency axis.
6
CMLab
• Least-squares Quadratics and Quartics
Instead of a straight line, fit by a quardratic (or a cubic) u(t)=A+Bt+Ct2
36,9,44,69,84,89,84,69,44,9,3611
21,14,39,54,59,54,39,14,219
2,3,6,7,6,3,27
3,12,17,12,35
,,min
4291
2311
211
351
22
m
m
m
m
CmBmAuCBAF m
7
CMLab
• The effect of the higher-degree polynomial is a higher degree of tangency at w=0
• The use of more terms in the smoothing formula makes the curve come down sooner.
8
CMLab
• Modified least squares :
Smoothing Window for 2N+1 points
modified Smoothing Windows for 2N+1 points
: reduce the two end values to one-half their assigned values
22
2
212
cossin
sin
2
1
cossin
sin
2
1
ww
w
N
Nw
N
wNw
NwH
9
CMLab
• The curve will come down more rapidly
• The main lobe is slightly wider.
★ the end constants can be chosen as a parameter
10
CMLab
• Differences and Derivatives
The difference operator
the operator annihilates a polynomial Pn(x) of degree n in X; that is
nKn
K
nnn
uu
uuu1
1
1n
01 xPnn
11
CMLab
from frequency point of view :
iwtKwiKwKiwtK
iwtwiw
iwtiw
iwttiwiwt
eeie
eie
ee
eee
22
22
1
sin2
sin2
1
12
CMLab
Since , so the amplification at frequency w is contained in the factor
; decreases the amplitude of any frequency△ ; there is an amplification
12 iKw
eiK
Kw2sin2
w
w
3
30
14
CMLab
Differences are also used to approximate derivatives.• Central difference formula
from the formula (with h=1)
iwtiwt
nnn
iwetuetu
h
uuu
so , set
...(1) 2
11
wiee iwiw sin2
15
CMLab
The ratio of the calculated to the true answer (which is iw) is :
w=0, R=1
w0, |R|<1 the formula underestimates the value of the derivatives for all other freqs.
For the 2nd derivate :
w
w
iw
wiR
sin
2
sin2
true
calculated
2
2
2sin
121
w
w
R
tutututu
16
CMLab
Spencer’s smoothing formula:
15-point:
21-point:
,...57,60,57,47,33,18,6,2,5,5,3,1
3,6,5,3,21,46,67,74,67,46,21,3,5,6,3
3501
3201
not informative
17
CMLab
plot the logs of the numbers |H(w)|
20 log|ratio| = decibel units (dB)
20 dB = factor of 10
18
CMLab
• Missing Data and Interpolation :The reasons or situations for the occurrence of “missin
g data” in a long record of data :• the measurements may never have been made;
they may have been misrecorded and thus later removed
• the formula used to compute successive values of the function may have involved an indeterminate form, such as at x=0, and the computer refused to divide by zero.
xxsin
19
CMLab
Usually, an interpolation formula based on the assumption that the data locally is a polynomial of some odd degree.
This is equivalent to the assumption that the next higher-order difference is zero.
20
CMLab
For instance, k=4
note: the sum of the sequences of the binomial coeffs. of order N is . Hence for the 2k th difference formula, the noise amplification is
211261
11224
44
0464
nnnnn
nnnnn
uuuuu
uuuuu
NNC2
1222
2242
kC
CCN
kk
kk
kk
A
31.1,3
,2
5.0,1
1817
A
A
A
Nk
Nk
Nk
22
CMLab
H(0)=1 However, for high freqs, the value is not too
good, particularly for very high freqs.• Negative values on the graph of the transfer functi
on imply a change in sign.
The above figure points out the damager of interpolating a missing value when the data is noisy, which means that the data has numerous high frequencies.
23
CMLab
Interpolation midpoint values : linear interpolation gives
if 4 adjacent points are used
221 cos
21
21
wnnn wHuuu
wwH
uuuuu
w
nnnnn
23
281
161
coscos9
9923
21
21
23
24
CMLab
• A Class of Nonre cursive Smoothing Filters
Design of filters :
H(0)=1 exact at dc(lowest freq.)
H()=0 no highest freq. get through
cwbwawH
eu
aubucubuauyiwn
n
nnnnnn
cos22cos2
let
2112
L.P.
25
CMLab
Since H()=0 the factor [cos w+1] had to occur
Now one can select a filter that approximately meets the requirement.
1coscos14
2022
122
81
21
41
awwawH
ac
b
cba
cba
26
CMLab
for Ex.1, if we require
aaH 221 21
21
2cos1cos
262
21
211281
wwwH
uuuuuy nnnnnn
Ex.2
if we set
21
21
2
1141
21
22
cos
2
wwH
uuuy
H
nnnn
27
CMLab
Ex. 3. S’pose that we try to do as well as possible in the neighborhood of zero freq.
21
0
23
2
0
3
3
80
0
10
adw
wHd
dw
wdH
H
w
w
28
CMLab
Ex: we pick our filter form as
3cos1cos
4104
41
2112161
wwwH
uuuuuy nnnnnn
1121
21
21
11
and
0,1 and
2cos2;
31
61
nnnn
ff
nnnn
uuuy
ba
fHfH
bfawHaubuauy
29
CMLab
• Integration : Recursive Filters
Trapezoid Rule (using y0=0)
2
221
0
121
1
sin2
cos
1
1 where
form theof is
0 , Set
w
w
iw
iw
itw
iwt
nnnn
ie
ewA
ewAty
yetu
uuyy
30
CMLab
The true answer for integration of is iwte iwtiw e1
...1
sincos
true
calculated
72012
2
221
42
ww
w
ww
iww
wAR
0 ,
1 , 0At
21
Rfw
Rw
31
CMLab
Simpson’s Rule :
w=0 , R=1
and has a tangency through the 3rd derivative
1131
11 4 nnnnn uuuyy
1801
cos2
3
4
4
sin31
wwwHR
ee
eewH
ww
iw
w
iwiw
iwiw
34
CMLab
• Simpson’s formula amplifies the upper part of Nyquist interval (the higher frequencies) where as the trapezoid rule damps them out.
• In the presence of noise. Simpson’s formula is more dangerous to use than are the trapezoid or midpoint formulas. But when there is relatively little high freq. In the function being integrated, then the flatness of Simpson’s formula for low freqs. show why it is superior.