Documente Academic
Documente Profesional
Documente Cultură
v (n)
NOISE
We discriminate between signal and noise in terms of the frequency spectrum
S (F ) Y (F )
V (F )
F0 F0 F
F0 F0 F0 F
Conditions for Non-Distortion
Problem: ideally we do not want the filter to distort the signal we want to recover.
x(t ) s (t ) y (t ) As(t T )
Same shape as s(t),
IDEAL just scaled and
2 FILTER 2
delayed.
1.5
1.5
1 1
0.5 0.5
0 0
-0.5 -0.5
-1 -1
-1.5 -1.5
-2 -2
0 200 400 600 800 1000 0 200 400 600 800 1000
constant | H (F ) |
Ae j 2FT if F is in the passband
H (F )
F 0 otherwise
linear
H (F )
F
For real time implementation we also want the filter to be causal, ie.
h( n)
h(n) 0 for n 0
since
n
y (n) h(k )
x
(nk)
k 0
past values only
FACT (Bad News!): by the Paley-Wiener Theorem, if h(n) is causal and with finite energy,
ln H ( ) d
2
1 2
log H ( ) log( 0) log H ( ) d
1
Characteristics of Non Ideal Digital Filters
| H ( ) | IDEAL
NON IDEAL
Two Classes of Digital Filters:
a) Finite Impulse Response (FIR), non recursive, of the form
x(n) y(n)
h( n)
h( n)
n
h( n) 0 h( n) 0
Problem: Given a desired Frequency Response Hd ( ) of the filter, determine the impulse
response h(n) .
Recall: we relate the Frequency Response and the Impulse Response by the DTFT:
H d ( ) DTFT hd (n) h ( n)ed
j n
n
hd (n) IDTFT H d ()
1
d
j n
H ( )e d
2
sin c n
c
1
hd (n)
2
Ae j n d A
n
A c sinc c
n
c
hd (n)
Hd ( )
DTFT
A
c
4
c c
n
Notice two facts:
• the filter is not causal, i.e. the impulse response h(n) is non zero for n<0;
• magnitude and phase are not independent, i.e. they cannot be specified arbitrarily
1.8
0.2
a) Windowing 1.6
1.4 0.15
1.2
0.1
1
hd (n) 0.8 0.05
0.25 0.6
0
0.4
0.2
0.2 -0.05
0.15 0
-100 -50 0 50 100 -0.1
L
-100 -50 0 50 100
L L
0.1
0.05
L
0
hamming window hw (n)
-0.05
2
0.25
-0.1
-100 -50 0 50 100 1.8
0.2
1.6
1.4 0.15
infinite impulse response 1.2
0.1
(ideal) 1
0.8 0.05
0.6
0
0.4
0.2 -0.05
0
-100 -50 0 50 100 -0.1
L
-100 -50 0 50 100
L L L
hw (n) h(n) hw (n L)
0.25
0.25
0.2
0.2
0.15 0.15
0.1 0.1
0.05 0.05
0 0
-0.05 -0.05
-0.1 -0.1
-100 -50 0 50 100 -100 -50 0 50 100
Effects of windowing and shifting on the frequency response of the filter:
1
a) Windowing: since hw (n) hd (n)w(n) then H w ( ) H d ( ) *W ( )
2
| W ( ) | rectangular window | H w ( ) |
40 20
20 0
0
-20
-20
-40
-40
H d ( )
* -60
-80
-60
-80
-100
-100
-120
-120 0 0.5 1 1.5 2 2.5 3
0 0.5 1 1.5 2 2.5 3
c c 40
hamming window
20
20
0
0
-20
-20
* -40
-60
-40
-60
-80
-80
-100 -100
-120 -120
0 0.5 1 1.5 2 2.5 3 0 0.5 1 1.5 2 2.5 3
For different windows we have different values of the transition region and the attenuation in the
stopband:
attenuatio n
20
Rectangular 4 / N -13dB 0
8 / N attenuation
Hanning -32dB -40
16 / N
-80
Blackman -58dB
-100
-120
with N 2L 1 0 0.5 1 1.5 2 2.5 3
hw (n) 0.25
0.2
0.15
transition
0.1 region
0.05
-0.05
-0.1
-100 -50 0 50 100
n
L L
Effect of windowing and shifting on the frequency response:
b) shifting: since h(n) hw (n L) then H ( ) H w ( )e jL
Therefore
H ( ) H w ( ) no effect on the magnitude,
H( ) H w ( ) L shift in phase.
See what is H w ( ).
For a Low Pass Filter we can verify the symmetry hw (n) hw (n). Then
H w ( ) h
n
w ( n )e j n
hw (0) 2 hw (n) cos( n)
n 1
-20
H ( ) -40
-60
dB
-80
-100
-120
0 0.5 1 1.5 2 2.5 3
H ( )
degrees
don’t care
Example of Design of an FIR filter using Windows:
Specs: Pass Band 0 - 4 kHz
Stop Band > 5kHz with attenuation of at least 40dB
Sampling Frequency 20kHz
Step 2: from pass band, determine ideal filter impulse
10
response
c c 2 2n
hd (n) sinc n sinc
5 5
Step 3: from desired attenuation choose the window. In this case we can choose the hamming
window;
Step 4: from the transition region choose the length N of the impulse response. Choose an odd
number N such that:
8
N 10
2 2(n - 40) 2 n
sinc 0.54 0.46 cos , if 0 n 80,
h( n) 5 5 80
0 otherwise
The Frequency Response of the Filter:
H( )
dB
H( )
rad
A Parametrized Window: the Kaiser Window
N Window Length
1.5
w[n] 0
1
1
0.5
5
10
0
0 20 40 60 80 100 120
n
There are some empirical formulas:
Attenuation in dB A N
Transition Region in rad
Example:
2
Sampling Freq. 20 kHz
P , S
Pass Band 4 kHz 5 2
Stop Band 5kHz, with 40dB Attenuation
N 45
S P
rad
10
A 40dB 3.3953
Then we determine the Kaiser window
w kaiser ( N , )
w[n]
n
Then the impulse response of the FIR filter becomes
sin c (n L)
h[n] w[n]
( n L)
ideal impulse
response
9
with c P S
1
2
20
N 45 2L 1 L 22
h[n ]
Impulse Response
| H ( ) |dB
Frequency Response
(rad)
Example: design a digital filter which approximates a differentiator.
Specifications:
• Desired Frequency Response:
j 2 F if 4kHz F 4kHz
H d (F )
0 if F 5kHz
2 2
jFs j 20,000 if - 5 5
H d ( ) H d ( F ) F F / 2
s
0
if | |
2
Step 2: determine ideal impulse response
2
5
hd (n) IDTFT H d ( )
1
2
2
j 20,000 e j n d
5
1
ax
e
ax
From integration tables or integrating by parts we obtain xe dx x
a a
Therefore
2n 2n
cos sin
20,000 4 5 2 5 if n 0
hd (n) 5 n n 2
0 if n 0
Step 3. From the given attenuation we use the Blackman window. This window has a transition
region region of 12 / N . From the given transition region we solve for the complexity N as
follows
2 12
0.1
2 5 N
which yields N 120. Choose it odd as, for example, N=121, ie. L=60.
2 (n 60) 2 (n 60)
cos sin
2 0.42 0.5 cos 2n 0.08 cos 4n
h(n) 20,000
4 5 5
5 n 60 (n 60) 2 120 120
for 0 n 120
Frequency Response
5
x 10
H ( )
2
1.8
1.6
4
1.2
x 10
3 1
0.8
2
0.6
1 0.4
0.2
0 0
0 0.5 1 1.5 2 2.5 3
-1
-2
-3
0 20 40 60 80 100 120 140 150
H ( ) dB 100
50
-50
-100
-150
-200
-250
0 0.5 1 1.5 2 2.5 3 3.5