Notes: frequency Magnitude frequency Magnitude

advertisement
Top
Notes:
As part of a system simulation it may be necessary to produce an “arbitrary” digital filter frequency and phase
response. Therefore strategies and techniques are required to produce such filters.
In the adaptive signal processing section we will review strategies for producing digital filter equivalents of
analogue channels based on input and output signals. Other methods are based on cross correlation of input
and output signals.
Low Pass Music Filtering:
Magnitude
Magnitude
Everyday experience of (analogue) filtering is listening to the neighbour’s music; only the low frequencies can
penetrate the walls. The wall is acting as a low pass filter.
frequency
frequency
WALL
The bass and treble controls of a hi-fi also allow filtering of the music signal before it is output by the
loudspeakers. Again a digital filter equivalent may be of interest here.
Developed by:
Top
Notes:
Digital Filters - Examples
•
A low pass filter to remove high frequency noise from a speech signal.
•
A band stop filter to remove 50Hz mains hum from an ECG (heartbeat) signal.
•
A bandpass filter to emphasise a particular frequency band of interest in a music signal (graphic equaliser).
•
An equalisation filter to equalise the response of a telephone channel.
•
A bandpass filter to extract a digitised bandlimited IF (intermediate frequency) modulated signal for mobile
radio.
•
A notch filter to remove resonant frequencies in the acoustics of rooms with public address.
•
A decimation low pass filter within a sigma delta converter.
•
and so on....!
An example of a non-linear filter would be a median filter, whereby the last N samples are stored in an array,
they are then ordered from largest to smallest and the output is the middle value in the array. This type of filter
can be useful for removing some forms of impulsive noise (scratches on an audio track), and is also used in a
2-D form for image processing.
Developed by:
Top
Notes:
z-domain Digital FIR Filters
Taking the z-transform gives:
N–1
Y( z) =
∑
w n X ( z )z – 1
n=0
The z-domain signal flow graph for a simple 3 weight filter ( N = 3 ) is:
X(z)
z--1
w0
z--1
w1
w2 Addition node
Y(z)
–1
–2
Y( z)
⇒ ------------ = H ( z ) = w 0 + z w 1 + z w 2
X( z)
Developed by:
Top
Notes:
Applying a unit impulse actually excites the filter at all frequencies. Why should this be?
First, if you take the DFT of an impulse the frequency spectrum obtained is flat. To further convince yourself,
try the following example:
Generate a series of sines waves with amplitudes of, say, 1 and frequencies of 10Hz, 20Hz, 30Hz,
40Hz..........200Hz. Add all of the sine waves together, and note that the result is an impulse like function with
period 10Hz:
0.1 sec
time
If you increase the series, to say 2000Hz, then the “impulses” become sharper:
0.1 sec
time
Decreasing the spacing between the harmonics: 1 Hz, 2Hz, 3Hz, 4Hz,.........2000Hz reduces impulse period:
1 sec
time
And therefore in the limit, as the frequency spacing tends to zero, a single impulse is produced.
Developed by:
Top
Notes:
Previously the Fourier transform was used to find the frequency content of a time signal.
Therefore it would seem reasonable to design a digital filter by taking the inverse DFT (IDFT) of a particular
frequency and phase response. Clearly if we were to take the inverse DFT of a brick wall filter, then the impulse
response would be non-causal and of infinite length:
Attenuation
1
-2ts
-ts
0
ts
2ts
Roll off rate = ∞
0dB
time
fc
frequency
Attenuation
To realise something that is causal we require to have a delay in the filter (corresponding to a phase shift in the
frequency domain), and when we truncate the filter length, the effect will be ripple in the frequency domain:
-2ts
-ts
0
ts
2ts
time
0dB
fc
frequency
Recall from the Fourier series of square time waveform, that if we truncate the Fourier frequency series to say
5 harmonics, then the square wave has “ripple”. The above is simply the same except the time domain is
Developed by:
truncated and the ripple is now in the frequency domain.
Top
Notes:
The simplest form of low pass filter is the moving average filter which simply averages the last N samples.
In everyday numerical analysis this is referred to as curve smoothing! Clearly smoothing to remove the high
frequency portions of a signal is akin to low pass filtering!
FIR Filter
x(k)
0.1
0.1
0.1
0.1
0.1
y(k)
The actual magnitude frequency response is simply given by:
Magnitude/dB
0
-10
-20
-30
fs/N
frequency/Hz
Developed by:
Top
Notes:
The simplest form of high pass filter is a differentiator where
y(k) = [x(k) – x(k – 1)]
FIR Filter
x(k)
1
-1
We reason intuitively why the low frequencies and
attenuated and high frequencies are passed through less
unattenuated.
y(k)
x(k)
y( k ) = [x( k) – x( k – 1) ]
High amplitude attenuation
x(k)
y( k ) = [ x( k) – x( k – 1) ]
Low amplitude attenuation
If a very low frequency
signal was input, then
the output y ( k ) is a
very small value (for a
DC, or 0 Hz input the
output is of course
zero.
If a high frequency
was
input
then
adjacent samples are
quite different values
and hence the output
is not of a negligible
magnitude:
Developed by:
Top
Notes:
The zeroes of a filter are likely to be complex numbers and can be simply represented on the complex plane.
Imag
ζ = a + jb
b
a
Real
The z-transform equation above is straightforward to derive from:
y ( k ) = x ( k )w 0 + x ( k – 1 )w 1 + x ( k – 2 )w 2 + x ( k – 3 )w 3
such that:
Y ( z ) = w0 X ( z ) + z
= [ w0 + z
–1
–1
w1 X ( z ) + z
w1 + z
–2
–2
w2 + z
w2 X ( z ) + z
–3
–3
w3 X ( z )
w 3 ]X ( z )
The zeroes may be complex numbers, which will always occur in conjugate pairs. See A-Z Conjugate Pair,
Finite Impulse Response, All -Pass Filter.
Developed by:
Top
Notes:
The implications of linear phase are quite important. In the case shown above we can say that the filtered signal
is delayed by Δ seconds. Consider now a non linear phase FIR filter. Consider a signal composed of the three
sinusoids with frequencies f 1 , f 2 and f 3 Hz as shown below. If this signal is filtered with the non linear phase
FIR structure each sinusoid will suffer a different delay Δ 1 , Δ 2 and Δ 3 :
f1
f2
f2
Δ2
non-linear
phase FIR
f3
t=0
f1
Δ1
f3
Δ3
time
time
t=0
In this case we cannot say that the signal has been delayed by a certain number of seconds, f 1 has been
delayed by Δ 1 seconds, f 2 by Δ 2 seconds, and f 3 by Δ 3 seconds. Depending on the application this could
have important consequences and the designer should therefore be aware of the implications of non-linear
phase FIR filters.
Developed by:
Top
Notes:
If all the zeroes of a filter lay within the unit circle in the z-domain plane he filter is said to be minimum phase.
If there are zeroes outside of the unit circle the system is non-minimum phase. An interesting property of linear
phase filters is that they are non minimum phase.
h(n)
Imag
0.4
2
0.3
0.2
z-domain
0.1
0
1
1
2
3
4
time, n
The impulse response of a simple 5 weight linear phase FIR filter
and the corresponding z-domain plane plot. Note that for the zeroes
inside the unit circle at z = – 0.286 ± 0.3526 j , there are
conjugate reciprocal zeroes at:
1
z = ------------------------------------------ = – 1.384 ± 1.727j
– 0.286 ± 0.3526 j
-1
0
1
Real
-1
-2
Developed by:
Top
Notes:
FIR Digital Filters Design Parameters
Most digital filter design software takes input of frequency response via “graphical” parameters
The user inputs desirable parameters to specify the acceptable tolerances from the ideal filter:
•
Type: Low Pass; High Pass, Bandpass; or Bandstop
•
Filter Sampling Frequency
•
Number of filter weights desired
•
Stopband Attenuation (in dBs)
•
Passband Ripple (in dBs)
•
Transition Bandwidth (in Hz)
Developed by:
Top
Notes:
.....Low Pass Filter Design 1
• Impulse Response; 55 filter weights required:
120.e-3
A
m
100.e-3
p
80.e-3
l
60.e-3
i
t
40.e-3
u
20.e-3
d
e
0
-20.e-3
0
1.e-3
2.e-3
3.e-3
4.e-3
5.e-3
6.e-3
• Frequency Response; DFT of Impulse Response:
M
0
a
g
n
i
-20
t
u
d
-40
e
d
B
-60
0
1.e+3
2.e+3
3.e+3
Frequency in Hz (Res = 7.813 Hz)
Developed by:
Top
Notes:
.....Low Pass Filter Design 2
• Impulse Response; 181 filter weights required:
A
800
m
p
600
l
i
400
t
u
200
d
e
0
-200
1.e-3
5.e-3
9.e-3
13.e-3
17.e-3
• Frequency Response; DFT of Impulse Response:
M
a
0
g
n
i
-20
t
u
d
-40
e
d
-60
B
0
1.e+3
2.e+3
3.e+3
Frequency in Hz (Res = 7.813 Hz)
Developed by:
21.e-3
Top
Notes:
Bandpass FIR Filter
Audio Demonstration: Removal of wideband noise from a narrowband 500Hz tone using a bandpass filter
490-510Hz fs = 16000Hz.No of MAC/sec = 16000 x FilterLength
.
Tone + Noise
510
490
time
time
freq (Hz)
Tone
Band Pass Filter
Audio Demonstration: Removal of narrowband noise (1000Hz to 1050Hz) from a speech signal with fs =
16000Hz.
time
1000
Speech + “Tone” Noise
time
freq (Hz)
Speech
Band Stop Filter
Developed by:
Download