1 systems and signals 1-3 - vrije universiteit amsterdamivo/psm/dsp/dsp.pdf · systems and signals...
TRANSCRIPT
Digital Signal Processing 2012
1 Systems and Signals .......................................................................................................... 1-31.1 Discrete and continuous signals 1-31.2 Basic discrete signals 1-41.3 Continuous signals 1-61.4 Discrete and continuous systems 1-81.5 How can we describe LTI systems ? 1-81.6 Continuous time 1-111.7 Discrete time Fourier series 1-121.8 Continuous time Fourier transforms 1-191.9 Minimum error approximation 1-231.10 Gibbs phenomenon 1-241.11 Fourier transform of non periodic signals 1-241.12 Fourier transform of a periodic signal 1-321.13 Sampling 1-321.14 Relation between spectra of discrete and continuous time signals 1-351.15 DFT Processing 1-361.16 The Fast Fourier Transform 1-381.17 Concluding remarks 1-401.18 References 1-401.19 Homework problems 1-412 The z-transform.................................................................................................................. 2-12.0 Introduction 2-12.1 Definition and properties of the z-transform 2-12.2 Inverse z-transform: contour integration 2-42.3 More properties of the z-transform 2-52.4 z-Plane poles and zeros 2-62.5 System stability 2-72.6 Geometrical evaluation of the Fourier Transform in the z-plane. 2-72.7 First and second order LTI systems 2-72.8 Nonzero auxiliary conditions 2-93 Design of nonrecursive (FIR) filters .................................................................................. 3-13.0 Introduction 3-13.1 Moving average filters 3-23.2 The Fourier transform method 3-43.3 Windowing 3-63.3.1 Rectangular window 3-63.3.2 Triangular window 3-63.3.3 Von Hann and Hamming windows 3-83.3.4 Kaiser window 3-93.4 Equiripple filters 3-103.5 Digital differentiators 3-114 Design of recursive (IIR) filters......................................................................................... 4-14.0 Introduction 4-14.1 Simple designs based on z-plane poles and zeros 4-14.2 Filters derived from analog designs 4-54.2.1 The bilinear transformation 4-6
Digital Signal Processing 2012
4.2.2 Impulse invariant filters 4-94.3 Frequency sampling filters 4-134.4 Digital integrators 4-154.4.1 Running sum 4-164.4.2 Trapezoid rule 4-164.4.3 Simpson’s rule 4-164.4.4 Comparison 4-165 Spectral analysis ................................................................................................................ 5-15.0 Introduction 5-15.1 Spectral leakage 5-15.2 Windowing 5-35.3 Investigating LTI systems 5-4
Systems and Signals Discrete and continuous signals
Digital Signal Processing 1-3 2012
1Systems and Signals
To analyse with a computer a physical entity which varies as a function of time, we have to transform it into an electrical signal, which has to be quantized in value and sampled in time. The general scheme is given in figure 1. First the physical entity is transformed by a transducer or sensor into an electrical signal , which varies continuously as a function of
time. This signal is then quantized in value at a fixed sample rate by an analog-to-digital converter (ADC), resulting in a discrete signal , which exists only for integer values of n
corresponding to time values in which is the sampling interval. This discrete
signal is processed by the computer with the digital signal processing (DSP) module. When the processed signal has to be presented as a continuous signal a digital to analog
converter (DAC) is needed.
First we will investigate properties of systems and signals. We will concentrate on the discrete case and show the comparable continuous situation. When the systems are linear and time-invariant the Fourier transform is a powerful tool to describe these systems. In the last section we will concentrate on the transition between the continuous and the discrete domain, and derive the sampling theorem of Nyquist and Shannon.
1.1 Discrete and continuous signals
We will denote a continuous signal as function of time by round brackets so is a
continuous signal and defined for all t.
We will denote a discrete signal by square brackets . This signal exists only for integer
values of n and is not defined for other values.
x t
x n t nT= T
y n
figure 1. Set-up of a Digital Signal Processing System.
physicalentity
Transducer ADC DSP DACelectricalsignal(continuous)
discretesignal
x t x n y n y t
x t
figure 2. (a) continuous signal as function of time.
(b) discrete signal
x t x n
t 0=
x t
a) b)n 0=
x n
Systems and Signals Basic discrete signals
Digital Signal Processing 1-4 2012
1.2 Basic discrete signalsunit step function:
Eq. 1
unit impulse function:
Eq. 2
The unit step function is the running sum of the unit impulse ; and is the
difference of two sample shifted step functions:
Eq. 3
Eq. 4
Multiplying a discrete signal with an impulse function selects one signal value as or in general
Eq. 5
An exponential discrete signal is in general given by
Eq. 6
where is real. When we are dealing with exponential growth, when with
exponential decay. In general the signal will start at a certain moment. So we will assume that the signal is zero until a certain moment . Without loss of generality we will assume
that the signal will start at so
Eq. 7
or
Eq. 8
In signal processing it is customary to use complex exponential signals to represent harmonic
functions. Recall that by definition and
Eq. 9
The complex conjugate , magnitude and phase of a complex number z are
u n 0= n 0u n 1= n 0
n 0= n 0 n 1= n 0=
u n n n
u n m
m –=
n
n l–
l 0=
= =
n u n u n 1– –=
x n n x 0 n =
x n n k– x k n k– =
x n Aen=
0 0
n k=
n 0=
x n Aen= n 0x n 0= n 0
x n Aenu n =
j 1–=
ejx x cos j x sin+= e j– x x cos j x sin–=
x cosejx e j– x+
2---------------------= x sin
ejx e j– x–2j
---------------------=
z z z arg
Systems and Signals Basic discrete signals
Digital Signal Processing 1-5 2012
defined in the following
Eq. 10
When in Eq. 8 is purely imaginary, so , the signal is given by
Eq. 11
When this signal is periodic, so for some N, we require
Eq. 12
This occurs when is a multiple of so which results in
Eq. 13
which means that when the fundamental frequency is (a multiple of) then the signal is
periodic. Thus periodic in time corresponds to discrete in frequency. When we investigate the discrete signals
Eq. 14
we see that all these signals are periodic with period N. These signals are called harmonically related. There are only N different frequencies because
Eq. 15
This means that there is an ambiguity in the discrete signal. The discrete signal with frequency k equals again the discrete signal with frequency k+N. This is also called aliasing. The spectrum of a discrete signal is periodic. Thus discrete in time corresponds to periodic in
frequency. What are the frequencies of the cosines in Figure 3? And what is the highest frequency?
z Re z jIm z += z Re z jIm z –=
z z j exp= z zz= z arg Im z Re z -------------- atan=
j=
x n Aejn A n cos jA n sin+= =
x n N+ x n =
ej n N+ ejn= ejN 1=
N 2 N m2=
m 2N------=
2 N
k n ejk0n= with 02N------=
k N+ n ej k N+ 2
N------ n
ejk
2N------ n
ej2n k n = = =
figure 3. Ambiguity in discrete signals
n=0
Systems and Signals Continuous signals
Digital Signal Processing 1-6 2012
The periodicity in frequency is demonstrated in Figure 4 for a different period . What
is now the highest frequency?In the general case we have the signals
Eq. 16
which results in an exponential growth or decay of the signal. When the signals originate from the real physical world we have in general to do with real valued signals, in which the is
given by
Eq. 17
1.3 Continuous signals
In the continuous case the step function is given by
Eq. 18
The step function is discontinuous at , it is the integral of the impulse function:
Eq. 19
To investigate this impulse function let us first define a function which is rectangularly
shaped and has area 1, so
Eq. 20
N 16=
figure 4. Demonstration of periodicity of for . Each point represents thechange in a single time step for a particular frequency k.
z ejk0= N 16=
x n Ae0nejn=
x n
x n Ae0n n + cosA2---e0nejn j+ A
2---e0ne jn– j–+= =
u t
u t 0= t 0u t 1= t 0
t 0=
u t d–
t
=
t
t 1 = 0 t
t 0= t 0 or t
Systems and Signals Continuous signals
Digital Signal Processing 1-7 2012
and
Eq. 21
The impulse function can be viewed as the limit of when :
Eq. 22
The area of the impulse function is 1. A discussion in more depth can be found in §8.7
of Arfken. The function plays a crucial role in the sampling of signals. so when we again take the limit we obtain
or in general
Eq. 23
For any arbitrary function the integral of that function multiplied with the Dirac delta function
figure 5. (a) Growing discrete-time sinusoidal signal; (b) decaying discrete-time sinusoid.
u t d
–
t
=
t 0
t 0lim t =
figure 6. and u t t
t =
1
0
1
0
t
x t t x 0 t = 0
x t t x 0 t =
x t t t0– x t0 t t0– =
Systems and Signals Discrete and continuous systems
Digital Signal Processing 1-8 2012
results in the value of that function when the argument of the Dirac delta function equals zero:
Eq. 24
1.4 Discrete and continuous systems
A system transforms signals:
A system is time-invariant, when the system gives the same output for a specific input,
independent of the time when this input is given. So the system will give today the same output for that input as yesterday, and as it will give tomorrow.
Time-invariant: Eq. 25
A system is linear when it is both additive and homogeneous.
Linear: Eq. 26
A result of Eq. 26 is that when for a linear system the input equals zero also the output should equal zero since . In the remainder of this chapter we will restrict
ourselves to linear time-invariant systems.
Examples of LTI systems are amplifiers, filters, oscillators. Actually, most systems in engineering, both electronical and mechanical, can be considered LTI systems.
1.5 How can we describe LTI systems ?
Given a discrete signal then holds or
Eq. 27
Eq. 27 means that when a discrete signal is multiplied by , a unit impulse with
time argument , the latter picks out the value where this time argument is zero, thus it
picks out . So now we can give a discrete signal as a summation of weighted impulse
x t x t – d
–
=
systemx n y n
y n
x n y n TI
x n n0– y n n0–
x1 n y1 n
x2 n y2 n L
ax1 n bx2 n + ay1 n by2 n +
0 0 x 0 y 0= =
L TI
LTI systems
x n x n n x 0 n =
x n n k– x k n k– =
x n n k– n k–
x k
Systems and Signals How can we describe LTI systems ?
Digital Signal Processing 1-9 2012
functions:
Eq. 28
When the input signal is an impulse the output signal of the system is called the impulse response
Eq. 29
So when the system is time-invariant this means that
Eq. 30
Linear and time-invariant means that
Eq. 31
or using Eq. 28
Eq. 32
This result is also called the convolution sum and denoted as . This
result shows that a LTI system is completely described by its impulse response. When we know the impulse response of a LTI system we can calculate for each input signal the
output signal by this convolution sum. The convolution (German: Faltung) is
commutative:
Examples:
#1 Given a system which calculates the moving average over three samples. What is its impulse response ?
Eq. 33
gives
Eq. 34
#2 Given a system (with ) described by the following recursive relation, what is its
impulse response ?
Eq. 35
gives
Eq. 36
x n x k n k–
k –=
=
x n n = y n h n =
n k– h n k–
x k n k– x k h n k–
y n x k h n k–
k –=
=
y n x n h n =
x n y n
y n x n h n h n x n = =
y n x n x n 1– x n 2– + + 3=
x n n =
h n n n 1– n 2– + + 3=
a 1
y n ay n 1– x n +=
x n n =
h n ah n 1– n +=
h n 1– ah n 2– n 1– +=
h n n a n 1– a2h n 2– + +=
Systems and Signals How can we describe LTI systems ?
Digital Signal Processing 1-10 2012
And by induction:
Eq. 37
In contrast to the previous example this is an infinite impulse response.
#3 Given the impulse response of a LTI system by with . What
is the output signal when the input is a unit step function ?
To calculate the output we must use the convolution sum of Eq. 32 with input :
Eq. 38
Now the two step functions limit the summation range to
Eq. 39
where we have used the formula for summing a geometric series. Note that since the unit step is the sum of the unit impulse, with a discrete LTI system, the step response is the sum of
the impulse response:
Eq. 40
A system is called causal if for . When a system is not causal it has already
an output before an input is present. A system is called stable if exists. This
means that a bounded input will give a bounded output. Note that the condition was
needed in Example #3 to ensure stability.
h n ak n k–
k 0=
an n k–
k 0=
anu n = = =
h n anu n = a 1
x n u n =
y n x k h n k–
k –=
u k an k– u n k–
k –=
= =
0 k n
y n an k–
k 0=
n
ak'
k' 0=
n
1 an 1+–
1 a–---------------------= = = n 0
figure 7. Output for example #3 with a 0.85=
s n
u n m
m –=
n
= s n h m
m –=
n
=
h n 0= n 0
h k k –=
a 1
Systems and Signals Continuous time
Digital Signal Processing 1-11 2012
1.6 Continuous time
Now we have to do with a LTI system of which the impulse response is when the input
signal is
Eq. 41
The output of the system is now given by a convolution integral instead of a convolution sum. The convolution integral is given by
Eq. 42
Convolution (German: Faltung) is a commutative operation which we abbreviate by an asterisk *:
Eq. 43
where we have transformed the integration variable to .
We may think of the continuous signal consisting of columns of width , and so the signal
consists of the weighted sum of pulses:
Eq. 44
For a time-invariant system results in the response which equals
shifted over a time interval so is given by
Eq. 45
h t t
t LTI
h t
y t x h t – d
–
=
hx x h t – d
–
h ' x t '– d'
–
xh= = =
' t –=
x t x k t k–
k –=
0lim=
t k– h t k–
h t k y t
y t x k h t k–
k –=
0lim x h t – d
–
= =
figure 8. Building a continuous signal from rectangular pulses
t
x t
a)0
1
0 k
t k–
t
Systems and Signals Discrete time Fourier series
Digital Signal Processing 1-12 2012
Note that this corresponds to replacing in the right hand side of Eq. 24, the
impulse function by its response .
A system is called causal if for . When a system is not causal it has already an
output before an input is present. A system is called stable if exists. This means
that a bounded input will give a bounded output. An example
#4 Given a LTI system with impulse response given by . What is the
output when the input signal is the unit step function: ?
Using the convolution integral, Eq. 42, we find
Eq. 46
Now the two step functions limit the integration range to :
Eq. 47
Note that since the unit step function is the integral of the impulse function, the step response corresponds to the integral of the impulse response (inserting in the second
convolution description of Eq. 43):
Eq. 48
and, for a causal system, .
Example #4 is the famous leaky integrator, also called low-pass filter, of which example #3 is the discrete analogon. The (first order) differential equation corresponding to this impulse response is given by
Eq. 49
The elementary responses of this so-called first order system are depicted in figure 9.
1.7 Discrete time Fourier seriesGiven a linear time-invariant system with an impulse response . So the output for
an input signal is given by
Eq. 50
x t – d–
x h t – d–
h t 0= t 0
h t td–
h t e at– u t =
x t u t =
y t x h t – d
–
u e a t – –u t – d
–
= =
0 t
y t ea t– d
0
t
ea t–
a----------------
0
t1a--- 1 e at–– = = = for t 0
s t x u=
s t h u t – d
–
h d
–
t
= =
s t h d0
t=
tdd
y t ay t + x t =
h n y n x n
y n x n h n x n k– h k
k –=
= =
Systems and Signals Discrete time Fourier series
Digital Signal Processing 1-13 2012
Now we ask ourselves, which signal after being transformed by a LTI system will give the same output signal (apart from a multiplicative factor). So what are the eigenfunctions
of a LTI system
Eq. 51
These eigenfunctions are given by , in which is a complex number or
Eq. 52
This can easily be seen by substituting Eq. 52 into Eq. 50 resulting in
Eq. 53
in which is defined by
Eq. 54
Note that in Eq. 53 a time shift is expressed by multiplication with the shift operator , and
. As z is a complex number it may be represented as .
We will restrict us now to or
Eq. 55
figure 9. Impulse response (a)and step response (b) offirst order system. 1 a
k n
k n LTI
kk n
zn z
x n n zn= =
y n zn k– h k
k –=
zn h k z k–
k –=
H z zn H z n = = = =
H z
H z h k z k–
k –=
=
z1–
x n k– zn k– z k– x n = = z rej=
r 1=
z ej=
Systems and Signals Discrete time Fourier series
Digital Signal Processing 1-14 2012
If we take for , then we obtain a harmonic sequence given by
Eq. 56
We will show now, that when is a periodic function with period N, it can be written as a
sum of eigenfunctions in which . So
Eq. 57
with . We already saw in Eq. 15 that there exist only N different functions
. The validity of Eq. 57 is demonstrated by showing that we can calculate the
coefficients . We can obtain in the following way: first multiply Eq. 57 with ,
this results in
Eq. 58
Next we sum Eq. 58 over n resulting in
Eq. 59
We now can distinguish two cases: and
Eq. 60
Eq. 61
since . In other words, and are orthogonal functions
on the interval . So only for the term between parentheses in Eq. 59 differs
from zero and . Dividing by N and replacing l by k we find
Eq. 62
k0=
zn ejk0n=
x n
k n ejk0n= 02N------=
x n akejk0n
k 0=
N 1–
=
x n x n N+ =
k n
ak ak e jl0n–
e jl0n– x n akejk0ne jl0n–
k 0=
N 1–
=
e jl0n– x n
n 0=
N 1–
akej k l– 0n
k 0=
N 1–
n 0=
N 1–
ak ej k l– 0n
n 0=
N 1–
k 0=
N 1–
= =
k l= k l
k l= ej0
n 0=
N 1–
N=
k l ej k l– 0n
n 0=
N 1–
1 xN–1 x–
--------------x e
j k l– 0=
1 ej k l– 0N–
1 ej k l– 0–--------------------------------- 0= = =
ej k l– 0N ej k l– 2= e jl0n– e jk0n–
0 N 1–{ , } k l=
e jl0n– x n n 0=
N 1– alN=
ak1N---- e jk0n– x n
n 0=
N 1–
=
Systems and Signals Discrete time Fourier series
Digital Signal Processing 1-15 2012
This results in the Fourier series of a periodic discrete signal given by
Eq. 63
Because the eigenfunctions are periodic, instead of summing from 0 to , we can sum
over N successive values starting from an arbitrary value, which is denoted by : one
period of the signal. As , also the Fourier coefficients are periodic with period
. So instead of the N different values of the signal the signal is also completely
described by the N different Fourier coefficients.
Examples:
#5 , ,
Eq. 64
This means that all N frequencies are equally strongly present in the impulse signal. So its frequency spectrum is flat.
#6
Eq. 65
In this case again the modulus of is independent of frequency, but the phase is a linear
function of the frequency.
#7 The Fourier coefficients of the l-th harmonic
Eq. 66
Eq. 67
ak1N---- e jk0n– x n
n 0=
N 1–
1N---- e jk0n– x n
n N == = analysis
x n akejk0n
k 0=
N 1–
akejk0n
k N == = synthesis
N 1–
k N =
ak ak N+= ak
N x n
x n n = 0 n N 1– x n x n N+ =
ak1N---- n e jkn 2 N–
n 0=
N 1–
1N----e0 1
N----= = =
x n n 1– =
ak1N---- n 1– e jkn 2 N–
n 0=
N 1–
1N----e jk 2 N–= =
ak
x n nl2 N sin=
ak1N---- nl2 N sin e jkn 2 N–
n 0=
N 1–
1N----
ejnl2 N
ej– nl2 N
–2j
----------------------------------------------- e
jkn 2 N–
n 0=
N 1–
= =
al12j-----= a l– aN l–
1–2j------= = ak 0 otherwise=
Systems and Signals Discrete time Fourier series
Digital Signal Processing 1-16 2012
#8
Eq. 68
Eq. 69
Let us now return to the fact that are the eigenfunctions of a LTI system. This means
that the Fourier coefficients of the output are those of the input , multiplied by the
eigenvalues . When the signal is periodic with period N and the impulse response of the
LTI system is periodic with the same period N, it can be shown that the output of the
system is given by the periodic convolution :
Eq. 70
The discrete Fourier coefficients of are in this case given by
Eq. 71
with the Fourier coefficients of the impulse response function. So we see that a
convolution in the time domain corresponds to a product in the frequency domain, and the eigenvalues of the LTI system equal N times the Fourier coefficients of the impulse response function. In the frequency domain an LTI system is thus described by the product with its transfer function (Dutch: overdrachtsfunctie). Similarly it can be derived that the Discrete Fourier Transform of a product of two functions in the time domain corresponds to a convolution in the frequency domain: the modulation property. If and possess,
respectively, Fourier coefficients and then
(modulation) Eq. 72
We see in Eq. 72 the duality of modulation and convolution (Eq. 70 and Eq. 71):
(convolution) Eq. 73
x n nl2 N cos=
ak1N---- nl2 N cos e jkn 2 N–
n 0=
N 1–
1N----
ejnl2 N
ej– nl2 N
+2
----------------------------------------------- e
jkn 2 N–
n 0=
N 1–
= =
al12---= a l– aN l–
12---= = ak 0 otherwise=
ej0k
bk ak
k
y n
y n x n h n x n m– h m
m 0=
N 1–
= =
bk y n
bk1N---- e jk0n– x n m– h m
m N =
n N = h m
m N =
1N---- x n m– e jk0n–
n N =
= = =
h m m N =
1N---- x l e jk0 l m+ –
l N =
h m e jk0m– ak
m N = Nakck= =
ck
x1 n x2 n
ak bk
x1 n x2 n ambk m–
m N =
x1 m x2 k m– m N = Nakbk=
Systems and Signals Discrete time Fourier series
Digital Signal Processing 1-17 2012
Other properties are: linear:
Eq. 74
time shift (of which Example #6 is an example with )
Eq. 75
Parseval
Eq. 76
Proof:
Eq. 77
We could think of as the energy present in one period of a signal.
When is the voltage across a resistor of , the dissipated energy in the resistor would
be . Parseval’s theorem means that the energy in the signal
is the same. It does not matter whether we express it in its time distribution or in its frequency distribution. When the signal is real, the spectrum is even: so . Only when is real
and even also the spectrum is real and even. So far we only looked at periodic signals , but what happens if the signal is not
periodic ? We can investigate this by letting N go to infinity. We will call now
where
Eq. 78
. For and the limits of are
px1 n qx2 n + pak qbk+
n0 1=
x n n0– e jk0n0– ak
1N---- e jk0n– x n n0–
n N =
1N---- e jk0 n n0– n0+ – x n n0–
n N = e jk0n0– 1
N---- e jk0l– x l
l N == =
1N---- x n 2
n N = ak
2
k N ==
1N---- x n x n
n N =
1N---- x n
n N = ejk0nak
k N =
= =
ak
k N =
1N---- x n e j– k0n
n N = ak
k N = ak
=
1 N x n 2n N =
x n 1V2 R x n 2 1 x n 2= =
x n ak a k–= x n
x n Nak X k
k k0=
x n 1N----X k ejkn
k N 1– 2–=
N 1– 2
1
2------
2N------X k ejkn
k N 1– 2–=
N 1– 2
= =
2N------ k 1+ k– = = N
N lim d= k
Systems and Signals Discrete time Fourier series
Digital Signal Processing 1-18 2012
so
Eq. 79
This transition from discrete to continuous frequencies is demonstrated in Figure 10. What is now the highest frequency?
We see that when is an aperiodic function of a discrete n, the frequency spectrum is a
periodic function of a continuous . The periodicity of the spectrum is the direct result of the
discrete nature of the signal. That is periodic with period can easily be verified by
showing that . We will see later that the frequency corresponds to
the sampling frequency. Also a convolution in the time domain corresponds to a product in the frequency domain: if
then
Eq. 80
in particular, for the response of a system
Eq. 81
2N------
N 1– 2
----------------- =
x n 12------ X ejnd
–
= X x n e jn–
n –=
=
figure 10. (left) Demonstration of periodicity of for .Each point represents the change in a single time step for a particular frequency k.
(right) Demonstration of periodicity of with continuous frequency . Each point onthe unit circle in the complex plane represents the change in a single time step for a particularfrequency .
z ejk0= N 128=
z ej
=
x n X 2
X 2+ X = 2
x1 n X1 x2 n X2
x1 n x2 n X1 X2
Y H X =
Systems and Signals Continuous time Fourier transforms
Digital Signal Processing 1-19 2012
Examples:
#9 The discrete Fourier transform of an impulse function is again flat (compare to example #5), but its value is now 1:
Eq. 82
#10 In the same way we obtain for a delayed impulse function (compare to example #6)
Eq. 83
#11 Frequency spectrum of a moving average filter of three terms (see example #1).
Eq. 84
Eq. 85
where we again used Eq. 9. We see that a moving average filter suppresses higher frequencies, up to half the sampling frequency, but these frequencies are still present.
1.8 Continuous time Fourier transforms
In the same way as in the discrete case we can pose the question: what are the eigenfunctions of a continuous LTI system. Think of a system consisting of a microphone, amplifier, and speaker. When the microphone is close to the speaker, the output is fed back to the input, and the system will start to oscillate. The tones which you will hear are the eigenfunctions of this system. These are , as can easily be verified by substituting into Eq. 42:
Eq. 86
x n n =DFT
X n e jn–
n –=
e0 1= = =
x n n 1– =DFT
X n 1– e jn–
n –=
e j–= =
h n n 1– n n 1+ + + 3=
H h n e jn–
n –=
13--- e jn–
n 1–=
1
13--- e
j1 e
j–+ + 1 2 cos+
3-------------------------------= = = =
figure 11. Frequency response of three-point moving average lowpass filter.
est est
y t x t h t h t x t h x t – d
–
= = = =
h es t – d
–
est h e s– d
–
estH s = =
Systems and Signals Continuous time Fourier transforms
Digital Signal Processing 1-20 2012
Note that analogous to Eq. 53 a time shift is expressed by multiplication with . So
Eq. 87
with . We will restrict ourselves to the eigenfunctions which are
periodic with period so with and . We can write a
periodic signal with period as
Eq. 88
This is the well known Fourier series of periodic functions. It can easily be seen that these two
equations are consistent. Multiplying the synthesis equation by the l-th harmonic we
find:
Eq. 89
Now we integrate this over a period :
Eq. 90
To evaluate the integral we must distinguish two cases:
Eq. 91
where we have used that and thus . Note in passing that
we have proved that the harmonics and are orthogonal functions. Inserting the
result from Eq. 91 into Eq. 90 we find
Eq. 92
which is the analysis equation from Eq. 88 for the l-th coefficient .
A Fourier series exists under the Dirichlet conditions, which are given by (for counter examples see figure 12.):
1) Over any period , must be absolutely integrable: .
e s–
est LTI
H s est
H s h e s– d–
=
T0 ejk0t k 0 1 2 = 0 2 T0=
T0
ak1T0----- x t e jk0t– dt
T0
= analysis
x t x t T0+ akejk0t
k –=
= = synthesis
e jl0t–
x t e jl0t– akejk0te jl0t–k –=
akej k l– 0t
k –=
= =
T0
x t e jl0t– dtT0
akej k l– 0tk –=
dt
T0
akk –=
ej k l– 0tdt
T0
= =
ej k l– 0tdtT0
k l= ej k l– 0tdtT0 T0=
k l ej k l– 0tdtT0
ej k l– 0t
j k l– 0------------------------
0
T0
1 1– 0= = =
0T0 2= ej k l– 0T0 e0
1= =
e jk0t– e jl0t–
x t e jl0t– dtT0 alT0=
al
T0 x t x t dtT0
Systems and Signals Continuous time Fourier transforms
Digital Signal Processing 1-21 2012
2) In any finite interval has a finite number of maxima and minima.
3) In any finite interval there are only a finite number of discontinuities.
Actually, these conditions are intuitively obvious: you cannot represent weird functions by a
x t
figure 12.
(b) 2 t sin
Systems and Signals Continuous time Fourier transforms
Digital Signal Processing 1-22 2012
series of well behaved functions, like the sines and cosines of .
In Eq. 86 we have shown that the eigenfunctions have eigenvalues .
Thus instead of calculating the convolution, we can first calculate the Fourier coefficients of the input, and multiply them by to find the Fourier coefficients of the output. Of course we
then need to use the synthesis equation to find the output signal in time.Let us look at some Fourier series examples:
#12 The Fourier coefficients of the periodic impulse function are all equal:
Eq. 93
#13 The Fourier coefficients of the l-th harmonic (see Eq. 9)
Eq. 94
Eq. 95
The magnitude ( ) of the coefficients is whereas the phase
( is given by and , respectively.
#14 (see Eq. 9)
Eq. 96
Eq. 97
The magnitude of the coefficients is whereas the phase is zero.
#15 Let us take a block wave given by
Eq. 98
which is periodic with period . We will apply Eq. 88 now to the interval . So
Eq. 99
ejk0t
ejk0t H jk0 Hk
Hk
t
ak1T0----- t e jk0t– dt
T0
1T0-----= =
x t 2lt T0 sin=
ak1T0----- 2lt T0 sin e jk0t– dt
T0
1T0-----
e2jlt T0
e2jlt T0–
–2j
----------------------------------------------- e jk0t– dt
T0
= =
al12j-----= a l–
1–2j------= ak 0 otherwise=
z zz= al a l– 1 2= =
z z j exp= 2– 2
x t 2lt T0 cos=
ak1T0----- 2lt T0 cos e jk0t– dt
T0
1T0-----
e2jlt T0
e2jlt T0–
+2
------------------------------------------------ e jk0t– dt
T0
= =
al12---= a l–
12---= ak 0 otherwise=
al a l– 1 2= =
x t
x t 1= t T1
x t 0= T1 t T0 2
T0 T– 0 2 T0 2[ , ]
a01T0----- dt
T1–
T1
2T1
T0-----= =
Systems and Signals Minimum error approximation
Digital Signal Processing 1-23 2012
and
Eq. 100
Note that so that we can synthesize
Eq. 101
where we have used Eq. 9 in the last step. Thus the even function is a linear combination
of even cosine functions, and the odd sine functions do not contribute. Using we
find for :
Eq. 102
which for the special case simplifies to (cf. figure 13.a)
Eq. 103
1.9 Minimum error approximation
in Eq. 88 contains an infinite number of terms. How many of them are necessary ?
Assume that we approximate a periodic signal by terms, so
Eq. 104
The error is in this case
Eq. 105
The energy of this error signal is
Eq. 106
It can be shown that minimization of gives the Fourier coefficients. So Fourier
coefficients minimize the energy in the error signal, and minimization is independent of the other coefficients. This is a consequence of the fact that the basisfunctions of the Fourier
ak1T0----- e jk0t– dt
T1–
T1
e jk0t–
j– k0T0---------------------
T1–
T1
2 ejk0T1 e j– k0T1– k0T0 2j
------------------------------------------------2 k0T1 sin
k0T0-------------------------------= = = =
ak a k–=
x t akejk0t
k –=
a0 ak ejk0t e jk0t–+
k 1=
+ a0 2ak k0t cos
k 1=
+= = =
x t 0T0 2=
k 0
ak
k0T1 sin
k----------------------------
2kT1 T0 sin
k--------------------------------------= =
T1 T0 4=
ak
2kT1 T0 sin
k--------------------------------------
k 2 sink
--------------------------= = ak 0= for k 2 4 =
x t ak
2N 1+
xN t akejk0t
k N–=
N
=
eN t x t akejk0t
k N–=
N
–=
EN eN t 2dtT0
eN t eN t dt
T0
= =
EN
Systems and Signals Gibbs phenomenon
Digital Signal Processing 1-24 2012
series are orthogonal functions.
1.10 Gibbs phenomenon
(see also Arfken §14.5) When there is a discontinuity in the signal , an approximation of
the signal by Eq. 104 will always result in an overshoot, independent of the number of coefficients. This overshoot equals 1.09. The error goes to zero, but the overshoot remains, and moves towards the discontinuity when increases. This a consequence of the fact that a discontinuity can never be described by continuous functions. Note that the signal
corresponds to the square wave with of which the coefficients were depicted in
figure 13.a. Using Eq. 101 we see that the DC and one cosine result in figure 14.a. Then the second cosine does not contribute, since it is even in the interval , whereas the
signal is odd relative to . Following the same line of reasoning, only the odd
cosines contribute, and the results with 3,7,19 and 79 cosines are shown in figure 14.b-e. The first two synthesis equations that apply to figure 14.a,b are:
Eq. 107
1.11 Fourier transform of non periodic signals
Just as we did in the discrete case, we will investigate the limiting case when the period T goes to infinity. We will call and with .
figure 13. Fourier series coefficients for the periodic square wave: (a) 4; (b) 8; (c) 16.T0 T1 =
x t
Nx t
T1 T0 4=
0 T0 2
x t t T0 4=
x1 t 12---
2--- 0t cos+= x3 t x1 t 2
3------ 30t cos–=
T ak XT = 2k T k0= = 0 2 T= =
Systems and Signals Fourier transform of non periodic signals
Digital Signal Processing 1-25 2012
Substitution into Eq. 88 gives
Eq. 108
and taking the limit:
Eq. 109
The Fourier expressions are summarized in the following Table
Examples:
figure 14. Convergence of the Fourier series representation of a square wave: an illustration of Gibbs
phenomenon. Here we have the finite series approximation for
several values of N.
xN t akejk0tk N–=
N=
x t 12------
2T
------XT ejt
k –=
=
x t 12------ X ejtd
–
= X x t e jt– dt
–
=
NN
2
T0
Systems and Signals Fourier transform of non periodic signals
Digital Signal Processing 1-26 2012
#16 For an impulse signal the frequency spectrum is again flat:
Eq. 110
and the inverse Fourier transform results again in the impulse:
Eq. 111
#17 Fourier transform of (note the resemblance with Eq. 111):
Eq. 112
since the -function is symmetric, and the inverse Fourier transform gives:
Eq. 113
#18 When is a rectangular function, so
Eq. 114
Eq. 115
Oppositely, when the spectrum is rectangular, the signal is a sinc function:
Eq. 116
Eq. 117
where is defined as .
x t t =F
X t e jt– dt
–
1= =
X 1= F1–
x t 1
2------ 1ejtd
–
t = =
ej0t
x t ej0t=F
X ej0te jt– dt
–
ej 0 – tdt
–
2 0 – = = =
2 0– =
X 2 0– = F1–
x t 1
2------ 2 0– ejtd
–
ej0t= =
x t
x t 1= t T1
x t 0= t T1
X x t e jt– dt
–
e jt– dt
T1–
T1
e jt–
j–-----------
T1–
T1e jT1– ejT1–
j–--------------------------------
2 T1 sin
--------------------------= = = = =
X 1= WX 0= W
x t 12------ ejtd
W–
W
Wt sint
-------------------W-----sinc Wt = = =
sinc x sinc x x sinx
-------------------=
Systems and Signals Fourier transform of non periodic signals
Digital Signal Processing 1-27 2012
Some properties of the Fourier transform (which we will denote by F) are
(DC component) Eq. 118
Linear: Eq. 119
Time shift: when then
Eq. 120
Differentiation: Eq. 121
Scaling: Eq. 122
Convolution: Eq. 123
Modulation: Eq. 124
figure 15. Fourier transform pairs of rectangular pulse (left) and of rectangular spectrum (right).
X 0 x t dt
–
=
ax1 t bx2 t +F
aX1 bX2 +
x t F
X
x t t0– F
X e jt0–
x t ej0t F
X 0–
tdd
x t F
jX
jt– x t F
dd
X
x at F
1a-----X
a----
x1 t x2 t F
X1 X2
x1 t x2 t F
1
2------X1 X2
Systems and Signals Fourier transform of non periodic signals
Digital Signal Processing 1-28 2012
Note that in Eq. 123 and Eq. 124 multiplication in one domain corresponds to convolution in the other domain. Thus an alternative calculation of the convolution in Eq. 42 would be to multiply the Fourier transforms:
Eq. 125
and then inversely transform . Note that complex integration can be quite cumbersome.
Note that we derived earlier that the eigenvalues of the LTI system were in Eq. 87. Thus
each sinusoid is multiplied by the corresponding , and a cascade of systems is
characterized by a transfer function which is the product of the individual transfer functions. Thus by applying Eq. 123 we find that the impulse response of a cascade of two systems is given by the convolution of the impulse responses of the two systems.
Parseval
Eq. 126
We could think of as the energy present in a signal. When is the voltage
across a resistor of , the dissipated energy in the resistor would be
. Parseval’s theorem means that the energy in the signal is the
same. It does not matter whether we express it in its time distribution or in its frequency distribution. For this reason is often referred to as the energy-density spectrum, of
power spectrum.
#19 Low-pass filter with impulse response given by with :
Eq. 127
The Fourier transform of the impulse response is called the transfer function. With the
low-pass filter the magnitude and phase are given by
Eq. 128
The logarithm of the magnitude and the phase of are usually plotted against on a
logarithmic scale, which is called a Bode plot. See figure 17.
Consider the simple first order RC circuit depicted in figure 18.When we take as the input the source voltage and take as the output the capacitor voltage , both
are related via the differential equation
Eq. 129
Y H X =
Y H s
H
x t 2 td
–
X 2 d2-------
–
=
x t 2 td–
x t
1V2 R x t 2 1 x t 2= =
X 2
h t e at– u t = a 0
H e at– e jt– dt
0
e at– e jt–
a j+ –-----------------------
0
1
a j+---------------
a j–a2 2+------------------= = = =
H
H 1
a2 2+----------------------= H arg
–a
------- atan=
H
x t vs t = y t vc t =
RCtd
dy t y t + x t =
Systems and Signals Fourier transform of non periodic signals
Digital Signal Processing 1-29 2012
figure 16. Magnitude and phase of for low-pass
filter.H
figure 17. Bode plot forlow-pass filterwhere
The power spectrum (top) is given in decibels, dB, which is
,
where the log is on base 10, so 20 dB attenuation corresponds to 10 times smaller amplitude. Alternatively, the power spectrum is calculated as
, which
obviously is identical.
a 1
20 H log
10 H 2 log
Systems and Signals Fourier transform of non periodic signals
Digital Signal Processing 1-30 2012
where we have used that the current is given by
Eq. 130
When we take the Fourier transform of Eq. 129 and apply the property that differentiation corresponds to a multiplication with in the frequency domain we find
Eq. 131
Eq. 132
Note that we have here three alternative descriptions of an LTI system: the differential
equation Eq. 129, the impulse response with , and the
transfer function Eq. 127, Eq. 132.
#20 The damped harmonic oscillator is a second order system described by the differential equation
Eq. 133
with the damping constant and the undamped resonance frequency. This is an LTI
system: multiplying the left and the right hand side with a we see that input gives rise to
output . The impulse response of this LTI system is given by
Eq. 134
where is the damped resonance frequency. Its transfer function is given by
Eq. 135
The amplitude and phase plots of Eq. 135 are shown in figure 19.Note that we have here three alternative descriptions of an LTI system: the differential equation Eq. 133, the impulse response Eq. 134, and the transfer function Eq. 135.
figure 18. First-order RC filter
Itd
dQC
tdd
vc t = =
j
RCj 1+ Y X =
H Y X ------------
1RCj 1+-----------------------= =
h t e at– u t = a1
RC--------
1---= =
t2
2
dd
y t 2td
dy t 0
2y t + + x t =
0
ax t ay t
h t t– 1t sinexp u t 1=
1 02 2– =
H 121---------
1 i 1+–---------------------------
1– i 1+ +
--------------------------------+ =
Systems and Signals Fourier transform of non periodic signals
Digital Signal Processing 1-31 2012
#21 a famous real life example of the damped harmonic oscillator is the automobile suspension system, which is schematically depicted in figure 20.
It is described by the differential equation
Eq. 136
where the elevation of the road is the input , and the is the position of the
chassis. M is the mass of the chassis, k and b are the spring and shock absorber constants. Fourier transformation of Eq. 136 gives:
Eq. 137
figure 19. Bode plot for second ordersystem.
The power spectrum (top) is given in decibels, dB, which is
,
where the log is on base 10, so 20 dB attenuation corresponds to 10 times smaller amplitude. Alternatively, the power spectrum is calculated as
, which obviously is
identical.
01 n
20 H log
10 H 2 log
figure 20.
Mt2
2
dd
y t btd
dy t ky t ++ kx t b
tdd
x t +=
x t y t y0+
M j 2 b j k+ + Y b j k+ X =
Systems and Signals Fourier transform of a periodic signal
Digital Signal Processing 1-32 2012
from which we compute the transfer function:
Eq. 138
with and . Ideally, this system is critically damped, , with a
relatively fast impulse response, and no oscillations.
1.12 Fourier transform of a periodic signal
We could also ask whether there exists a Fourier transform of a periodic signal. This is indeed the case, and the spectrum can be derived from the Fourier series coefficients. If
then can be written as (Eq. 88) thus
Eq. 139
Substitution of Eq. 112 into Eq. 139 results in
Eq. 140
This means that there is a direct relation between the coefficients of a Fourier series and the spectrum of a periodic signal. Eq. 140 gives the relation between the frequencies in the real world continuous system, and the integer k representing the frequencies in the discrete representation and the value is .
1.13 SamplingAfter the discussion of the discrete and continuous case, we are now ready to investigate the conversion from continuous to discrete signals. Sampling can be described by multiplying the signal with a sampling function consisting of an infinite sequence of -functions. When
is the continuous signal and is the sampled signal then:
Eq. 141
where , and T denotes the sampling interval. So is given by
Eq. 142
and . The Fourier transform of is given by (combine Eq. 124 and
H Y X ------------
bM----- j k
M-----+
j 2 bM----- j k
M-----+ +
-----------------------------------------------------
02
2 j +
02
2 j j 2+ +--------------------------------------------------= = =
02
k M= 2 b M= 0=
x t x t T+ = x t akejk0tk –=
X F x t F akejk0tk –=
akF ejk0t
k –=
= = =
X ak2 k0–
k –=
=
k k 2 T 2 ak
x t xp t
xp t x t p t =
p t t nT– n –=
= xp t
xp t x nT t nT–
n –=
=
x n x nT = xp t
Systems and Signals Sampling
Digital Signal Processing 1-33 2012
Eq. 141):
Eq. 143
Now the question is: what is ? is a periodic signal so its Fourier coefficients are
given by Eq. 88
Eq. 144
and its Fourier transform is found using Eq. 140:
Eq. 145
which is again a sequence of -functions but now in the Fourier domain, at an interval
. And
Eq. 146
This means that the spectrum of is repeated at multiples of the sampling frequency .
Again this highlights the point that discrete in time corresponds to periodic in frequency. Sampling of the signal results in a periodic spectrum. This we know already from our analysis of discrete signals. When the signal is limited in frequency, and its maximum frequency is smaller than half the sampling frequency, the repeated spectra will not overlap, and the original signal can be reconstructed. This is the well known sampling theorem of Nyquist and Shannon, which states the following:
If is a bandlimited signal with when , then is uniquely
determined by its samples if with .
The effect that the spectra overlap when is called aliasing.
To reconstruct the original continuous signal we have to multiply the periodic spectrum with a window which filters out one period:
Eq. 147
Xp 12------X P 1
2------ X – P d
–
= =
P p t
ak1T--- p t e jkot– dt
T
1T--- t nT–
n –=
e
jkot–dt
T 2–
T 2
1T---e jkonT– 1
T---= = = =
P 2T
------ k0–
k –=
=
0 2 T=
Xp 12------ X – 2
T------ k0–
k –=
d
–
1T--- X k0–
k –=
= =
X 0
x t X 0= M x t
x nT n 0 1 2 = s 2M s 2 T=
s 2M
H
H 1= s 2
H 0= s 2
Systems and Signals Sampling
Digital Signal Processing 1-34 2012
This means a convolution in the time domain with a reconstruction filter given by
Eq. 148
and the reconstructed signal is given by
Eq. 149
It is interesting to note that the zeros of are at ( ) or
. This we could expect as the sampled values are exact at the sample
points. As the sinc function is a very expensive function for convolution, often more simple reconstruction filters are used. As these are less good in their frequency response the sampling frequency should be a little higher than twice the maximum frequency (see e.g. Lynn and Fuerst).
figure 21. Effect in the frequency domain of sampling in the time domain: (a) Spectrum of original signal;(b) spectrum of sampling function, note the periodicity with . (c) spectrum of
sampled signal with ; (d) spectrum of sampled signal with , note that in
the overlapping regions the spectrum “adds up”, frequencies higher than will turn
up below, namely at , which is just above .This is called aliasing.
s 2fs=
s 2M s 2Mh s 2
h s– – s 2
h t 12------ H ejtd
–
1
2------ ejtd
s 2–
s 2
ejt
j---------
s 2–
s 2 st 2 sin
t---------------------------
s
2------sinc
st
2-------- = = = = =
xr t
xr t xp t h t x nT s t nT– 2 sin
t nT– ---------------------------------------------
n –=
= =
h t st 2 k= k 0
t 2k s kT= =
Systems and Signals Relation between spectra of discrete and continuous
Digital Signal Processing 1-35 2012
1.14 Relation between spectra of discrete and continuous time signalsWe will call the spectrum of the continuous time signal and the spectrum of
the discrete time signal, then:
Eq. 150
Eq. 151
We already saw that
Eq. 152
We can view Eq. 151 as a summation of delta functions multiplied by coefficients .
As the Fourier transform of the delta function is given by Eq. 152, and using the fact that the Fourier transform is linear, taking the Fourier transform of Eq. 151 results in
Eq. 153
figure 22. Ideal bandlimited interpolation using the sinc function.
Xc Xp
Xp 1T--- Xc ks–
k –=
=
xp t xc nT t nT–
n –=
=
t F
1 t nT–
F
e jnT–
xc nT
Xp xc nT e jnT–
n –=
=
Systems and Signals DFT Processing
Digital Signal Processing 1-36 2012
The discrete time Fourier transform of was given by Eq. 79:
Eq. 154
Comparing Eq. 153 and Eq. 154 results in
Eq. 155
which means that in the discrete case corresponds to the sampling frequency in the continuous case: , which is . Thus the sampling maps a continuous frequency axis extending from till to the new frequency axis extending from till . The latter axis for then runs from till So far we have seen that a periodic and discrete signal results in a periodic and discrete spectrum. The Fourier transform of an aperiodic and discrete signal results in a periodic and continuous spectrum. In the computer we can only represent discrete signals and spectra, so we need a discrete spectrum. Now there exists a dual sampling theorem: if we observe a signal a limited time, say from 0 to , then the spectrum is completely described by samples at an interval Hz, so . If we have N samples in a time frame with sampling interval , then in the discrete spectrum , so N samples over one period of are sufficient. If we transform a certain time frame of an aperiodic signal according to the Discrete Fourier Transform, then we make the signal by doing that periodic, we repeat that time frame periodically.
1.15 DFT Processing
Spectral analysis gives decomposition of a signal in its frequency components. Spectral analysis is used for instance in the analysis of natural signals and in the investigation of systems like vibrations in buildings and mechanical systems, in radar and sonar.Spectral analysis with the DFT means discrete time and discrete frequencies, so a limited time
x n
X x n e jn–
n –=
xc nT e jn–
n –=
= =
X XpT---- =
2=2 T s– s 2– s 2
–
T01 T0 2 T0= T0T T0 N= T 2T T0 2 N= = =
2
figure 23. Relationships between the DFT, Fourier transform and discrete Fourier series. Notethat in (b) both and are periodic with .x n ak N 7=
Systems and Signals DFT Processing
Digital Signal Processing 1-37 2012
observation window, which is repeated to obtain a periodic time-signal, in order to apply the DFT.The DFT of a signal that contains only harmonic frequencies (multiples) of the fundamental frequency , results in a line spectrum. The DFT of a signal that contains frequencies which are not harmonic frequencies of the fundamental frequency gives a widening of the spectral lines, this widening is called leakage. Now we may ask ourselves what is the cause thereof.The reason is that we observe the signal only during a limited time window, say from to
. We may see this as multiplying the signal with a rectangular window given by:
Eq. 156
and . Now the continuous Fourier transform of would have been
Eq. 157
and the Fourier transform of is given by Eq. 115:
Eq. 158
When we would sample this signal the resulting discrete frequency is given by , so
Eq. 159
So let us assume that we have N samples on the limited time window then and
Eq. 160
The zeros of this function occur when and . So these are a multiple of the fundamental frequency , and thus harmonic frequencies of . When the signal contains only harmonic frequencies of the fundamental frequency, in the convolution we do not see the leakage, as the leakage is just zero in the discrete frequency samples. When the signal contains frequencies for which Eq. 160 is not zero, we do see the leakage.We define the amount of leakage as the distance between the first two zeros of which equals . The larger we take N, the smaller the leakage. The leakage can be decreased by taking other types of windows with lower side lobes (see e.g. Lynn and Fuerst).
0 2 N=
T1–T1 w t
w t 1= t T1
w t 0= t T1
xb t x t w t = xb t
Xb 12------X W =
W w t
W 2 T1 sin
--------------------------=
T=
W 2T T1 T sin
-------------------------------------=
T1 T1– T1 NT 2=
W 2T N 2 sin
-----------------------------------=
N 2 k= k 0 2k N=0 2 N= 0
x t
W 20 4 N=
Systems and Signals The Fast Fourier Transform
Digital Signal Processing 1-38 2012
1.16 The Fast Fourier Transform
The Discrete Fourier Transform was given by Eq. 63, we will call this for the moment
Eq. 161
This means that for complex numbers we need four multiplications for , and one
takes multiplications. As there are N of them in total we need multiplications.
So the complexity of the DFT is . In particular for large N this becomes very time
consuming. The Fast Fourier Transform gives a solution to this problem.
figure 24. Fourier transformation of (a) a signal containing three exact Fourier harmonics, and (b) a signalcontaining both harmonic and non-harmonic components which exhibit leakage (each abscissa:512 samples). Note that the frequency index runs from 0 (the DC) till 255, and then from -256 till-1, because (which is ) is periodic with .A sinusoid is always represented by
two frequencies, cf. Eq. 9 and Eq. 95, and thus also the leakage of a non-harmonic component isvisible at both positive and negative frequencies.
ak X k N 512=
X k Nak=
X k Nak e jk0n– x n
n 0=
N 1–
= =
e jk0n– x n X k 4N 4N2
O N2
Systems and Signals The Fast Fourier Transform
Digital Signal Processing 1-39 2012
We could write Eq. 161 as
Eq. 162
in which is given by
Eq. 163
There are only N different values of because as soon as this value is the same as
with . Let us assume now that N is a power of two, then we can apply the
decimation in time: split in the even and odd terms:
Eq. 164
and by definition thus
Eq. 165
So instead of a N-point DFT we have now two points DFTs. We could repeat this trick
on and and obtain four points DFTs, until we end up with two points
DFTs which are inputs apart. Now how many multiplications are needed? We have N
multiplications with ’s in each step. In total there are steps. So the total number of
multiplications is and the complexity of the FFT is instead of
for the DFT.
X k x n wNkn
n 0=
N 1–
=
wN
wN e j0– e j2 N–= =
wNkn kn N
mod kn N X k
X k x 2r wN2rk x 2r 1+ wN
2r 1+ k+
r 0=
N 2 1–
= =
x 2r wN2 rk wN
k x 2r 1+ wN2 rk
r 0=
N 2 1–
+
r 0=
N 2 1–
wN2 e j2 N 2– wN 2= =
X k x 2r wN 2 rk wNk x 2r 1+ wN 2 rk
r 0=
N 2 1–
+
r 0=
N 2 1–
G k wNk H k += =
N 2G k H k N 4
N 2w log2N
Nlog2N O Nlog2N O N2
Systems and Signals Concluding remarks
Digital Signal Processing 1-40 2012
The speed up can easily be demonstrated by Table 1:
1.17 Concluding remarksIn these notes we have discussed the basic theory of systems and signals and concentrated on the relation between the continuous and discrete time. A further discussion can be found in (6). The situations which occur in real world signals are analysed by the computer. Important issues such as digital filter design and stability of digital systems fall outside the scope of these notes. An introduction into these topics can be found in (3, 4). Most useful is (4), who give Matlab demo’s for illustration and filter design. For further reading we recommend (2, 5, 6, 7).
1.18 References
1 Arfken, G. Mathematical methods for physicists. 3d ed. Academic Press: Orlando, 1985.
2 Ludeman, L.C. Fundamentals of digital signal processing. Wiley: New York, 1987.
3 Lynn, P.A.; Fuerst, W. Introductory Digital Signal Processing with computer applications.
Wiley: Chicester, 1990.
4 McClellan, J.H.; Schafer, R.W.; Yoder, M.A. Signal Processing First. Pearson Education
International, Pearson Prentice Hall: Upper Saddle River, NJ, 2003
5 Oppenheim, A.V.; Schafer, R.W. Digital Signal Processing. Prentice/Hall: Englewood
Cliffs, NJ, 1975.
6 Oppenheim, A.V.; Willsky, A.S.; Nawab, S.H. Signals and systems. 2nd edition. Prentice/
Hall: London, 1997.
7 Roberts, R.A.; Muller, C.T. Digital Signal Processing. Addison Wesley: Reading, 1987.
Table 1: Speed up of FFT relative to DFT
speed up
16 64 256 4
64 384 4096 10
256 2048 32
1024 102
4096 342
N Nlog2N N2
65310
10310 1
610
49310 16
610
1610 20
610 11210 50
310
Systems and Signals Homework problems
Digital Signal Processing 1-41 2012
1.19 Homework problems
Study the lecture notes until section 8
exercise H.1 Recursive filter with one coefficient
Consider the difference equation ( )
Eq. 166
What are the impulse response , and step response for the causal LTI system
satisfying this difference equation ? (you may find Example #2 useful, check that you understand every equation in section 5)Make a plot of and for a-values of -0.9, -0.5, 0.5 and 0.9. (you might find
Mathematica, Excel or Matlab useful, or you can sketch it on paper). In Mathematica you can use the function RSolve, and choose a zero initial condition at time -1. For plotting use DiscretePlot.
What is frequency response ? (use the right hand side of Eq. 79, you may find Example
#11 useful) Sketch (analogous to Fig.9) the magnitude of the
frequency response for a-values of -0.9, -0.5, 0.5 and 0.9 from to .
Describe also the action of these filters in a couple of words (keywords: low-pass, high-pass, strong, weak).Alternatively, you can Fourier transform Eq. 166:
Eq. 167
and use the time shift property (e.g. Eq. 83) to find
Eq. 168
and thus we have:
Eq. 169
Recall that a convolution in the time domain corresponds to a multiplication in the frequency domain (Eq. 80):
Eq. 170
Now you can use the last two equations to calculate . The result should be identical to
the previous result with direct calculation by means of the right hand side of Eq. 79.
a 1
y n ay n 1– x n +=
h n s n
h n s n
H
H H H =
2–= 2=
y n e jn–
n –=
ay n 1– e jn–
n –=
x n e jn–+=
y n e jn–
n –=
ae j– y n 1– e j n 1– –
n –=
x n e jn–
n –=
+=
Y ae j– Y X +=
Y H X =
H
Systems and Signals Homework problems
Digital Signal Processing 1-42 2012
exercise H.2 Discrete time Fourier series of simple moving average filterConsider the difference equation
Eq. 171
What is the impulse response for the periodic LTI system satisfying this difference
equation ? Calculate from this impulse response the Fourier coefficients . Note that since the system is
periodic (with period N) you can summate from -N/2 until N/2-1. Make a plot of the from
-N until N. (Hint: don’t forget that ). Describe also the action of this filter in a
couple of words (keywords: low-pass, high-pass, strong, weak).
exercise H.3 Discrete time Fourier series of differentiator
Consider the difference equation
Eq. 172
What is the impulse response for the periodic LTI system satisfying this difference
equation ? Calculate from this impulse response the Fourier coefficients . Note that since the system is
periodic (with period N) you can summate from -N/2 until N/2-1. Make a plot of the from
-N until N. (Hint: don’t forget that ). Describe also the action of this filter in a
couple of words (keywords: low-pass, high-pass, strong, weak).
exercise H.4 Recursive filter with two coefficientsConsider the difference equation
Eq. 173
What is the frequency response for the causal LTI system satisfying this differenceequation ? (Hint: use the time shift property, e.g. Eq. 83) and follow the same procedure as inEq. 167-Eq. 170.Sketch the magnitude of the frequency response.Factorize the denominator of the frequency response.
What is the partial fraction expansion ( ) of the frequency response? (Hint: you
can use the Mathematica function Apart)What are the impulse response , and step response? (Hint: Use results from exercise H.1).In Mathematica you can use the function RSolve, and choose a zero initial condition at times -1 and -2. Describe also the action of this filter in a couple of words (keywords: low-pass, high-pass,strong, weak, etc.).
y n x n 1– x n x n 1+ + + 3=
h n
ak
ak
02N------=
y n x n 1– 2x n – x n 1+ + 4– =
h n
ak
ak
02N------=
y n 16---y n 1– –
16---y n 2– x n + +=
H
a b+ab
------------1a---
1b---+=
h n
Systems and Signals Homework problems
Digital Signal Processing 1-43 2012
exercise H.5 Calculation of Spectral Leakage in discrete timeIn Figure 25, the abscissa value of the dots indicates the position of the harmonics, whereas theordinate value corresponds to the magnitude of the frequency spectrum . What function is represented by the solid line (Hint: Figure 15)? Calculate the frequency spectrum for a sinusoid with frequency(a) midway between two harmonics in the points A,B,C,D (Hint: carefully read section 1.15and apply the proper equation)(b) a quarter of the way between two harmonics in the points A,B,C,D and A’,B’,C’,D’.
Can you relate these results to Figure 24 ?
exercise H.6 Calculation of Spectral Leakage in continuous time
Compute the spectral broadening of a laser pulse of 500 nm with a square amplitude profile of 1 ns duration. This means that you observe the signal only during a limited time window, from
to , with ns. Now compute the spectrum of this laser pulse. What is the
spectral width ? And what is ?
H
H
figure 25. Frequency spectrum for a sinusoid with frequency (a) midway between twoharmonics, (b) a quarter of the way between two harmonics.
H
T1– T1 T1 0.5=
t
Digital Signal Processing The z-transform
versie 1.1 2-1 2012
2The z-transform
2.0 Introduction
The z-transform should be regarded as a generalization of the Discrete Fourier Transform. It offers a technique for the frequency analysis of digital signals and systems, providing an extremely compact notation for describing digital signals and systems. It is widely used by DSP designers and in the DSP literature. The so-called pole-zero description of a system is a great help in visualizing its stability and frequency response characteristics.
2.1 Definition and properties of the z-transform
We recollect that the eigenfunctions of an LTI system in discrete time are given by , with z
a complex number. The output of a system with impulse response is given by:
Eq. 2-1
Inserting we find
Eq. 2-2
Thus are eigen functions with eigen value .
The z-transform is now defined as
Eq. 2-3
As z is a complex number it may be represented as . Previously we restricted us to the unit circle in the complex plane, , which corresponds to the Fourier transform:
LTI
x n y n
h n
zn
h n
y n x n h n h k x n k–
k –=
= =
x n zn=
y n h k zn k–
k –=
zn h k z k–
k –=
znH z = = =
zn H z h k z k–k –=
=
X z x n z n–
n –=
=
z a jb+ rej= =r 1=
Digital Signal Processing The z-transform
versie 1.1 2-2 2012
Eq. 2-4
Example #2.1:
the Fourier and the z-transform of an exponentially decaying signal
Eq. 2-5
where the sum converges if and thus . When the DFT sum diverges. However, the z-transform of this signal is given by
Eq. 2-6
The region of convergence (ROC) of this sum is defined by or equivalently
. For the ROC does not include the unit circle, consistent with the fact that for those a-values the DFT does not converge.For , is the unit step with
Eq. 2-7
Now let then the z-transform of this signal is given by
Eq. 2-8
where the sum converges if or equivalently . Thus the z-transforms of these two signals differ only in their ROC.
We calculate the z-transform of a cosine
with the help of Eq. 2-6:
Eq. 2-9
When we are dealing with a causal signal ( for ) we find the unilateral z-transform:
X ej x n ej n–
n –=
x n e j– n
n –=
= =
x n anu n =
X ej ae j– n
n 0=
1
1 ae j––----------------------= =
ae j– 1 a 1 a 1
X z x n z n–
n –=
az 1– n
n 0=
1
1 az 1––-------------------
zz a–-----------= = = =
az 1– 1z a a 1
a 1= x n u n
X z zz 1–-----------= z 1
x n an– u n– 1– =
X z az 1– n
n –=
1–
– az 1– n–
n 1=
– 1 a 1– z n
n 0=
– 11
1 a 1– z–-------------------–
zz a–-----------= = = = =
a 1– z 1 z a
x n n0 ucos n 12--- ejn0 e j– n0+ u n = =
X z 12---
1
1 ej0z 1––--------------------------
12---
1
1 e j– 0z 1––----------------------------+
z z 0 cos–
z2 2z 0 cos– 1+-----------------------------------------------= =
x n 0= n 0
Digital Signal Processing The z-transform
versie 1.1 2-3 2012
Eq. 2-10
If is a causal signal (right sided sequence) then the following property holds: if the
circle is in the ROC, then all finite values of z for which will also be in the
ROC. This can be seen as follows: if the circle is in the ROC, then is
absolutely summable. Since is right-sided, then multiplied by any real
exponential sequence which decays faster than will also be absolutely summable.
An important property of the (unilateral) z-transform is its relation to time shifting. Let us consider the z-transform of an impulse
Eq. 2-11
We can view z as a time-shift operator: multiplication by is equivalent to a delay of one sampling interval, a backward shift, whereas multiplication by z is equivalent to a forward shift. More formally, the z-transform of is given by:
Eq. 2-12
Figure 2.1. Pole-zero plot and region of convergence for z-transform of exponentially decaying signals of Example #2.1: (left) (right)
.x n anu n =
x n an– u n– 1– =
X z x n z n–
n 0=
=
x n z r0= z r0
z r0= x n r0n–
x n x n r0
n–
x n n = X z n z n–
n –=
1= =
x n n n0– = X z n n0– z n–
n –=
z n0–= =
z 1–
x n n0– u n n0–
x n n0– u n n0– z n–
n –=
z n0– x n u n z n–
n –=
z n0– X z = =
Digital Signal Processing The z-transform
versie 1.1 2-4 2012
The convolution property also holds for the z-transform:
Eq. 2-13
where is the transfer function. This can easily be seen by taking the z-transform of both
sides of (Eq. 2-1):
Eq. 2-14
Eq. 2-15
2.2 Inverse z-transform: contour integrationThe inverse z-transform is defined by
Eq. 2-16
where the integration is along a counterclockwise circular contour centered at the origin with radius r, where r can be chosen as any value for which converges. A useful procedure to find the inverse of a rational z-transform consists of expanding the algebraic expression into a partial fraction expansion and recognizing the sequence associated with the individual terms. For example we calculate the signal having z-transform as
follows: assume that we can write as
Eq. 2-17
from which we have to solve for A, B and C. After a little algebra we find , and
. Thus
Eq. 2-18
We now recall that multiplication by is equivalent to a delay of one sampling interval.
The terms between brackets produce the inverse transform
(where we have used Eq. 2-6, Eq. 2-7 and Eq. 2-11) so the required is given by
Eq. 2-19
y n h n x n = Y z H z X z =
H z
y n h k x n k– k –=
=
y n z n–
n –=
h k x n k– z n–
k –=
n –=
=
Y z h k z k–
k –=
x n k– z n k– –
n –=
H z X z = =
x n 12j-------- X z zn 1– dz=
X z
X z 1 z z 1– 2z 1– =
X z
X z 1z z 1– 2z 1– --------------------------------------
Az---
Bz 1–-----------
C2z 1–--------------+ += =
A 1= B 1=
C 4–=
X z 1z---
1z 1–-----------
42z 1–--------------–+ z 1– 1
zz 1–----------- 2
zz 0.5–---------------–+
= =
z 1–
n u n 2 0.5nu n –+
x n
x n n 1– u n 1– 2 0.5n 1– u n 1– –+=
Digital Signal Processing The z-transform
versie 1.1 2-5 2012
The z-transform may also represent an LTI system which we denote by . The
corresponding time function must correspond to the system’s impulse response . From Eq. 2-13 we have
Eq. 2-20
Consider again our previous example
Eq. 2-21
giving
Eq. 2-22
which we can write as
Eq. 2-23
Using again the time-shift property we find
Eq. 2-24
To find the corresponding time function , we deliver a unit impulse as input
signal, and evaluate term-by-term:
Eq. 2-25
Evaluation of this recursive relation gives the impulse response described by Eq. 2-19. Thus we find , , and so on.
2.3 More properties of the z-transformWe have already discussed some properties of the z-transform in Section 2.1: linearity, convolution and time-shift. Note the corresponding properties of the Fourier transform, since
.
The initial value theorem for a causal sequence may be stated as follows:
Eq. 2-26
which can easily be seen by inserting the definition of the (unilateral) z-transform :
only the term will remain.
The final value theorem may be stated as follows:
H z h n
H z Y z X z -----------=
H z 1z z 1– 2z 1– --------------------------------------
Y z X z -----------= =
z z 1– 2z 1– Y z X z =
2 3z 1–– z 2–+ Y z z 3– X z =
2y n 3y n 1– – y n 2– + x n 3– =
h n n h n
h n 1.5h n 1– 0.5h n 2– – 0.5 n 3– +=
h 3 0.5= h 4 0.75= h 5 0.875=
z ej=
x n
x 0 X z z lim=
X z
X z z lim x n z n–
n 0=
z
lim= n 0=
Digital Signal Processing The z-transform
versie 1.1 2-6 2012
Eq. 2-27
Note that is the z-transform of . We use this Eq. 2-27 to calculate the steady state responses of a system. For example the
steady state response of a system with transfer function to a step input
.
Eq. 2-28
2.4 z-Plane poles and zerosThe z-transform of an exponential signal ( ) is a ratio of polynomials. The z-transform of any real digital signal or transfer function can be written as a rational function of the frequency variable z:
Eq. 2-29
Apart from a gain factor K this transform may be completely specified by the roots of the numerator and denominator:
x n n lim
z 1–z
----------- X z
z 1lim=
z 1– z 1 z 1––= n n 1– –
Figure 2.2. Properties of the unilateral z-transform.
H z z z 0.8– =
u n
y n n lim
z 1–z
----------- Y z
z 1lim
z 1–z
-----------
z 1lim X z H z = =
z 1–z
-----------
z 1lim
zz 1–----------- z
z 0.8–--------------- 1
1 0.8–---------------- 5.0= = =
an
X z N z D z -----------=
Digital Signal Processing The z-transform
versie 1.1 2-7 2012
Eq. 2-30
where and are called the zeros and poles of . When the corresponding time function is real, then the poles and zeros are themselves either real, or occur in complex conjugate pairs. A useful representation of a z-transform is obtained by plotting its poles and zeros in the complex z-plane.
2.5 System stabilityA system is called stable when a bounded input results in a bounded output ,
which is equivalent to . When we must have
, thus the z-transform must exist on the unit circle.
For a causal system we get the condition , thus the z-transform must
exist on the unit circle and outside of it, for . The ROC is determined by singularities.
Thus for a causal and stable system all poles must be inside the unit circle.
An example of a causal and stable system is given by the exponentially decaying signal
described in Example #2.1: with .
2.6 Geometrical evaluation of the Fourier Transform in the z-plane.Assume that we want to evaluate the Fourier transform for a certain frequency. We draw a vector from each pole and zero to a point on the unit circle representing the sinusoidal frequency of interest. Then the magnitude of the spectral function equals the product of all zero-vector lengths, divided by the product of all pole-vector lengths (disregarding the gain factor K). The phase equals the sum of all zero-vector phases, minus the sum of all pole-vector phases.Thus with poles close to the unit circle the spectral magnitude function peaks, whereas with zeros close to or on the unit circle it goes through a minimum.An example of a transfer function with a pole at and
a zero at is shown in Figure 2.4.
Substituting gives the frequency response of the system:
Eq. 2-31
2.7 First and second order LTI systemsFirst and second order systems can be considered as building blocks for more complicated systems. Thus a system with transfer function can be viewed as a cascade of first and second order subsystems with transfer functions:
X z N z D z -----------
K z z1– z z2– z p1– z p2–
-----------------------------------------------= =
zi pi X z
x y '
h n n –=
z 1=
h n z n–n –=
h n z n–n 0=
z 1
x n anu n = a 1
H z z 0.8– z 0.8+ = z 0.8–=
z 0.8=
z ej=
H ej 0.8–ej 0.8+---------------------=
H z
Digital Signal Processing The z-transform
versie 1.1 2-8 2012
Eq. 2-32
Figure 2.3. Unilateral z-transform pairs.
H1 z z z1– z p1–
------------------=
Digital Signal Processing The z-transform
versie 1.1 2-9 2012
Eq. 2-33
as the poles and zeros of a real function are either real or occur in complex conjugate pairs.Examples of a first order system with are shown in Figure 2.5. With
the pole on the positive real axis we get a low pass filter, whereas a pole on the negative real axis results in a high pass filter.
Next we consider a second order system with a complex conjugate pole-pair ,
as shown in the right-hand part of Figure 2.5. The frequency at which the peak
gain occurs (the center frequency) is determined by the parameter . The selectivity (or bandwidth) of the systems is determined by the parameter r. The two zeros are placed at the origin to ensure that the impulse response begins at . Dividing numerator and
denominator by gives
Eq. 2-34
and hence the difference equation
Eq. 2-35
2.8 Nonzero auxiliary conditionsThe unilateral z-transform can also cope with nonzero auxiliary (or initial) conditions. A system of order k requires k auxiliary conditions. For example we consider here a first order system with difference equation:
Eq. 2-36
Figure 2.4. Visualizing the frequency response of an LTI system.
H2 z z z2– z z3– z p2– z p3–
-------------------------------------=
H1 z z z – =
p2 rej=
p3 re j– =
n 0=
z2
H2 z Y z X z -----------
11 2r cos z 1–– r2z 2–+----------------------------------------------------------= =
y n 2r cos y n 1– r2y n 2– – x n +=
y n y n 1– – x n =
Digital Signal Processing The z-transform
versie 1.1 2-10 2012
The z-transform of is given by:
Eq. 2-37
Thus taking the z-transform of Eq. 2-36 we find which leads to
Eq. 2-38
Thus with nonzero auxiliary (or initial) conditions ( ) the ratio of and
is not equal to .
Figure 2.5. (left) Characteristics of first-order systems. (right) The z-plane pole-zero configuration of a second-order system.
y n 1–
Y1 z y n 1– z n–
n 0=
y 1– y n 1– z n–
n 1=
+= =
y 1– z 1– y n z n–
n 0=
+ y 1– z 1– Y z +=
Y z y 1– z 1– Y z + – X z =
Y z X z y 1– +1 z 1––
-----------------------------------=
y 1– 0 Y z X z H z
Digital Signal Processing Design of nonrecursive (FIR) filters
versie 1.1 3-1 2012
3 Design of nonrecursive (FIR) filters
3.0 Introduction
The general form of difference equation for a causal LTI system is given by:
Eq. 3-1
In a nonrecursive filter the output depends only on present and previous inputs and not on previous outputs ( ):
Eq. 3-2
The coefficients are simply the successive terms in the impulse response of the filter. Since the number M of coefficients must be finite, a practical nonrecursive filter is called FIR (finite impulse response). The transfer function is found by taking the z-transform of Eq. 3-2:
Eq. 3-3
and the frequency response is found by putting in Eq. 3-3:
Eq. 3-4
The question is now how to choose the coefficients of a desired filter.
Idealized filter frequency responses are shown in Figure 3.1.A FIR filter is inherently stable, because it has no poles outside of the origin. As the impulse response is finite it can be chosen symmetrical in form. This produces an ideal linear-phase characteristic, equivalent to a pure time delay of all frequency components passing through the filter (no phase distortion). To illustrate this last point we start with a noncausal impulse
response with transfer function
Eq. 3-5
aky n k–
k 0=
N
bkx n k–
k 0=
M
=
N 0=
y n bkx n k–
k 0=
M
=
bkbk
H z Y z X z ----------- bkz k–
k 0=
M
= =
z ej
=
H bke jk–
k 0=
M
=
bk
h n bkx n k– k M–=
M=
H bke jk–
k M–=
M
b0 2 bk k cos
k 1=
M
+= =
Digital Signal Processing Design of nonrecursive (FIR) filters
versie 1.1 3-2 2012
which is a real function of , implying a zero-phase filter (no phase shift at any frequency).
To make this filter causal we shift by M sampling intervals: and
thus converting the zero-phase characteristic into a pure linear-phase
one.
3.1 Moving average filtersThe impulse response of a simple moving average filter is given by
Eq. 3-6
The z-transform of this is given by:
Eq. 3-7
Figure 3.1. Idealized digital filter frequency responses: (a) low-pass, (b) high-pass, (c) bandpass, and (d) bandstop.
h n h n h n M– =
H e jM– H =
Figure 3.2Impulse responses giving (a) zero-phase, and (b) linear-phase characteristics.
h n 1
2M 1+-----------------
0
=n Mn M
h n
H z 12M 1+----------------- z n–
k M–=
M
1
2M 1+-----------------
z2M 1+ 1–zM z 1– ------------------------= =
Digital Signal Processing Design of nonrecursive (FIR) filters
versie 1.1 3-3 2012
To find its transfer function we substitute into Eq. 3-5:
Eq. 3-8
The causal filter possesses 2M poles in the origin (because of the time shift we add) and 2M zeros spaced around the unit circle, but the zero at is missing (Eq. 3-7), which accounts for the passband centered at . Examples with and are shown in Figure 3.3.
Note that these the magnitude responses of these low-pass filters, which are often used in practice, are far from the ideal low-pass filter characteristic of Figure 3.1.a. From a low-pass filter a simple high-pass or bandpass filter can be derived. The basic idea is to multiply, or modulate, the original impulse response by , where is the desired center frequency of the filter. By the modulation property of the Fourier transform we find
Eq. 3-9
For our moving-average low-pass filter we get, taking for example (and using Eq. 3-6):
bk 1 2M 1+ =
H 12M 1+----------------- 1 2 k cos
k 1=
M
+
12M 1+-----------------
2M 1+ 2 sin 2 sin
-----------------------------------------------= =
z 1= 0= M 2= M 10=
Figure 3.3. Frequency response magnitude characteristics of low-pass moving-average filters: (a) 5-term, and (b) 21-term. Parts (c) and (d) show their respective z-plane pole-zero configurations.
n0 cos 0
n0 cos h n H 12--- 0– 1
2--- 0+ +
0 3=
Digital Signal Processing Design of nonrecursive (FIR) filters
versie 1.1 3-4 2012
Eq. 3-10
which characteristics with are shown in Figure 3.4.
As noted before, this filter characteristic is far from the ideal band-pass filter characteristic. Rather than start with a simple form of impulse response we should calculate the impulse response which best approximates a specified frequency response.
3.2 The Fourier transform methodIn principle the impulse response is found from the inverse Fourier transform of the
desired frequency response :
Eq. 3-11
Thus for an ideal low-pass filter with cut-off frequency we find
Eq. 3-12
To shift the passband to we multiply this expression by
Eq. 3-13
To find the frequency response characteristic of a truncated (FIR) we substitute it into
h n 1
2M 1+-----------------
n3
------ cos
0
=n Mn M
M 10=
Figure 3.4. Deriving a simple bandpass filter from a low-pass prototype: (a) impulse response, and (b) frequency response magnitude function.
h n H
h n 12------ H ejn d
2=
1
h n 12------ ejn d
1–
1
n1 sin
n-----------------------
1
-------sinc n1( )= = =
0 n0 cos
h n 1
-------sinc n1( ) n0 cos=
h n
Digital Signal Processing Design of nonrecursive (FIR) filters
versie 1.1 3-5 2012
Eq. 3-5:
Eq. 3-14
which will give a better approximation with increasing M.
Thus a close to ideal filter requires many coefficients (Figure 3.6.). When contains a
step like transition ( ) the output will show oscillations and overshoots as a result
of the high frequencies present in the transition, a phenomenon which is called ringing. The Fourier transform design method gives the best approximation in a least squares sense. Denoting the desired and actual frequency response function by, respectively, and
H 1
------- 2 h k k cos
k 1=
M
+=
Figure 3.5. Impulse responses of two ideal, zero-phase, low-pass filters.
Figure 3.6. Frequency responses of three linear-phase bandpass filters, obtained by truncating the ‘ideal’ impulse response.
x n u n y n
Hd
Digital Signal Processing Design of nonrecursive (FIR) filters
versie 1.1 3-6 2012
, the overall error e which is defined as:
Eq. 3-15
is minimal.
3.3 WindowingTruncation of in the time domain (as we did in the previous section) is equivalent to
multiplication with a rectangular window function . Because of the modulation
property of the Fourier transform this is equivalent to a convolution in the frequency domain:
Eq. 3-16
So let us now investigate some window functions.
3.3.1 Rectangular window
We recall from Eq. 3-6:
Eq. 3-17
3.3.2 Triangular window
Eq. 3-18
The triangular window can be regarded as a self-convolution of a rectangular window. Now time-domain convolution is equivalent to frequency domain multiplication. Therefore, when plotted on a logarithmic scale, the ( terms) triangular window has sidelobe levels half
as great as those of the ( terms) rectangular window, as can be seen by comparing
Figure 3.7. and Figure 3.8.The most widely used logarithmic measure of spectral magnitude (or gain) G is the decibel, which is defined as .
Ha
e1
2------ Hd Ha – 2 d
2=
h n w n
ha n hd n w n = Ha Hd W =
w n 1
0
=n Mn M
W 1 2 k cos
k 1=
M
+=
w n M 1+ n–
M 1+ 2-------------------------------
0
=n Mn M
W 1M 1+--------------
2M 1+ 2
--------------------- M 1+ k– k cos
k 1=
M
+=
2M 1+
M 1+
dB: 20log10G
Digital Signal Processing Design of nonrecursive (FIR) filters
versie 1.1 3-7 2012
Figure 3.7. Spectra of rectangular windows with (a) 21 terms, and (b) 51 terms.
Figure 3.8. (a) A triangular function, and (b) the spectrum of a 41-term triangular window.
Digital Signal Processing Design of nonrecursive (FIR) filters
versie 1.1 3-8 2012
3.3.3 Von Hann and Hamming windows
Since all practical windows involve a compromise between the shape of the main lobe and sidelobe levels, there must be a trade-off between a sharp passband-stopband transition and low ripple levels in the actual filter. Two windows which have a main spectral lobe similar to that of a triangular window, but smaller sidelobe levels (see Figure 3.9.) are defined by:
Eq. 3-19
Von Hann: (Figure 3.9.b, also referred to as Hanning window).
Hamming: . (Figure 3.9.c)
w n A 1 A– n
B------ cos+
0
=n Mn M
W 1 2 w k k cos
k 1=
M
+=
A 0.5= B M 1+=
A 0.54= B M=
Figure 3.9. Spectra of 51-term windows: (a) triangular, (b) von Hann, and (c) Hamming.
Digital Signal Processing Design of nonrecursive (FIR) filters
versie 1.1 3-9 2012
3.3.4 Kaiser window
In contrast to the previous windows which had fixed shapes, the Kaiser window offers the designer the possibility to adjust the trade-off. It is defined as:
Eq. 3-20
where is the modified Bessel function of the first kind and of zero order, which may be
expanded as a power series: . If the Kaiser
window is similar to the Hamming window. The design of the Kaiser window is based on the following findings:
The parameter depends upon the allowable ripple value . Then the transition width is
related to the window length. Hence if is specified we can find the parameter M.
The ripple level is expresses as an attenuation in decibels:
Eq. 3-21
The following empirical formulae are often used:
Eq. 3-22
w n I0 1
nM----- 2
–
I0 ----------------------------------------
0
=n Mn M
I0
I0 x 11n!-----
x2--- n
2
n 1=
+= 5.44=
Figure 3.10. Specifying the design of a Kaiser-window filter.
A 20log10–=
0.1102 A 8.7– = ifA 50
0.5842 A 21– 0.4 0.07886 A 21– += if21 A 50 0= ifA 21
MA 7.95–28.72--------------------
Digital Signal Processing Design of nonrecursive (FIR) filters
versie 1.1 3-10 2012
3.4 Equiripple filtersThe basic idea is to distribute the error between desired and actual response more equally over the range . We illustrate this for a low-pass equiripple filter.
In the passband ( ) the acceptable level of ripple is ; in the stopband
( ) the acceptable level of ripple is . The width of the transition band is
. The ripple peaks and troughs occur at . We start with an impulse
response which is symmetric about . The frequency response takes the general form:
Eq. 3-23
Now a term can always be expressed as a sum of powers of . Therefore
Eq. 3-23 can be recast as:
Eq. 3-24
an Mth order trigonometric polynomial which can display up to local extrema
within the range , corresponding to ripple peaks and troughs. Differentiating Eq. 3-
24 with respect to we obtain
Eq. 3-25
Since when there are extrema at these frequencies. Hence there are
at most local extrema within the range . The widely used approach of Parks
and McClellan allows to specify and the ripple ratio , while allowing the
actual value of to vary. Their approach has the advantage that the transition bandwidth
0
Figure 3.11. Specifying an equiripple low-pass filter.
0 p 1
s 2
s p– 1 2
n 0=
H h 0 2 h k k cos
k 1=
M
+=
k cos cos
H ck cosk
k 0=
M
=
M 1– 0
H dd
H ckk cosk 1–
k 1=
M
sin–= =
sin 0= 0 =
M 1+ 0 M p s 1 2
1
Digital Signal Processing Design of nonrecursive (FIR) filters
versie 1.1 3-11 2012
( ) is properly controlled.
3.5 Digital differentiatorsAn LTI system which forms the first order difference (FOD) of an input signal
Eq. 3-26
may be thought of as a ‘differentiator’. The corresponding frequency response is
Eq. 3-27
with magnitude function
Eq. 3-28
However, accurate differntiation is only achieved for the lower part of the frequency range
. An ideal differentiator has , since differentiating a Fourier term
proportional to with respect to n gives . A magnitude response proportional to
is found only with small values of in Eq. 3-28. In general
Eq. 3-29
Until now we only considered real impulse responses , which were symmetrical about
leading to real transfer functions . An odd, purely imaginary
corresponds to an odd, antisymmetrical impulse response about .
The inverse Fourier transform of is given by
Eq. 3-30
where we have integrated by parts. We thus find for an ideal differentiating filter
s p–
y n x n x n 1– –=
H 1 e j–– 2je j 2– 2 sin= =
H 2 2 sin=
Figure 3.12. Frequency responses of digital differentiators.
0 H j=
ejn jejn
H A jB +=
h n n 0= H A =
H jB = n 0=
H j=
h n 12------ jejn d
–
1
2------
jejn
jn-----------------
–
ejn
n---------- d
–
–
12------ ejn
n----
1jn2-------–
–
= = =
Digital Signal Processing Design of nonrecursive (FIR) filters
versie 1.1 3-12 2012
Eq. 3-31
Again, multiplication with a window function is necessary. Examples are shown in Figure 3.13. and Figure 3.14.
h n 0
1 n1 n–
=
n 0=
n 2 4 =
n 1 3 =
Figure 3.13. Impulse response of differentiator of Eq. 3-31 truncated to 21 terms and shifted to begin at n 0=
Figure 3.14. Frequency responses of two nonrecursive differentiators based on (a) a rectangular window, and (b) a hamming window.
Digital Signal Processing Design of recursive (IIR) filters
versie 1.1 4-1 2012
4 Design of recursive (IIR) filters
4.0 Introduction
The output from a recursive digital filter depends upon one or more previous output values, as well as on inputs. The great advantage thereof is computational economy: a filter characteristic requiring say 100 coefficients in a nonrecursive realization can often be obtained using just a few recursive coefficients. However, there are two potential disadvantages: (a) the recursive filter may become unstable if its feedback coefficients are chosen badly (b) recursive designs cannot generally provide the linear phase responses so readily achieved by nonrecursive methods, so there is phase distortion.In most cases a recursive filter has an infinite impulse response (IIR). Although the impulse response decays towards zero as , it theoretically continues forever. Assuming
the filter is causal ( for ) this means that the impulse response cannot be
symmetrical in form, and therefore the filter cannot display a pure linear-phase characteristic.In contrast to the nonrecursive filter the recursive filter has one or more strategically placed z-plane poles. We may write the difference equation ( , ):
Eq. 4-1
and transfer function
Eq. 4-2
Factorizing the numerator and denominator polynomials of Eq. 4-2 we obtain the pole-zero description of the filter:
Eq. 4-3
with frequency response
Eq. 4-4
4.1 Simple designs based on z-plane poles and zerosAs discussed in Section 2.6 and Section 2.7 a pole close to the unit circle gives rise to a well-defined response peak, whereas a zero close to (or on) the unit circle produces a trough (or null). Our aim in this section is to show how z-plane poles and zeros can be positioned to give
h n n h n 0= n 0
N 0 M 0
aky n k–
k 0=
N
bkx n k–
k 0=
M
=
H z Y z X z ----------- bkz k–
k 0=
M
akz k–
k 0=
N
= =
H z K z z1– z z2–
z p1– z p2– -----------------------------------------------=
H K ej z1– ej z2–
ej p1– ej p2– ----------------------------------------------------------=
Digital Signal Processing Design of recursive (IIR) filters
versie 1.1 4-2 2012
a variety of simple, but useful, recursive filters. Suppose we specify a real pole at . It contributes the following factor to the
denominator of :
Eq. 4-5
Its magnitude contribution is therefore:
Eq. 4-6
A real zero gives an identical contribution, but to the numerator of .
When in Eq. 4-6 then and thus constant. When is close to 1
becomes very small for resulting in large values of the transfer function.
A complex conjugate pole-pair, or zero-pair, with polar coordinates makes a
contribution:
Eq. 4-7
and the magnitude is
Eq. 4-8
This results when r is close to 1 in small values of for and thus in large
values of the transfer function. We can build up an overall response by assessing the contributions of individual poles or pole-pairs, and zeros or zero-pairs in turn. Examples are shown in Figure 4.2. and Figure 4.1.
This is equivalent to synthesizing the system as a series of cascaded first and second order subsystems. Such a realization is often referred to as the cascade canonic form in the DSP
z =
H
F1 ej – cos – j sin+= =
F1 cos – 2 sin2+ 1 2 cos– 2+= =
H
0= F1 1= F1
=
r
F2 ej rej– ej re j–– e2j 2r cos ej– r2+= = =
2 cos 2r cos cos– r2+ j 2 sin 2r cos sin– +
F2 2 cos 2r cos cos– r2+ 2 2 sin 2r cos sin– 2+=
F2 =
Figure 4.1. (a) A pole-zero configuration, and (b) the equivalent spectral magnitude function, normalized to a peak value of 0 dB.
Digital Signal Processing Design of recursive (IIR) filters
versie 1.1 4-3 2012
literature.
As a second example we design a recursive bandpass filter with the following characteristics: (a) a passband centered at , with a bandwidth of between -3 dB points and a
peak gain of unity. (b) steady-state rejection of components at and .
To meet the passband centering we place a complex conjugate pole pair at . It is
assumed that a pole close to the unit circle is entirely responsible for the response peak. The radius r can be found as follows, and is illustrated in Figure 4.3.
Figure 4.2. Spectral magnitude functions produced by (a) a single real pole at ; (b) a second order zero at ; (c) a complex conjugate pole pair at ,
; and (d) a complex conjugate zero pair on the unit circle at .
z 0.9=z 0.8–= r 0.975=
150= 50=
2= 40 0= =
2=
Figure 4.3. (a) Measuring the -3 dB bandwidth; (b) relationship between bandwidth and the radius of a z-plane pole.
Digital Signal Processing Design of recursive (IIR) filters
versie 1.1 4-4 2012
The -3 dB bandwidth corresponds to a distance around the unit circle (which
approximates a straight line in this region), and hence to a change in of radians:
Eq. 4-9
To reject at we place zeros on the unit circle at . The complete pole-zero
configuration is shown in Figure 4.4.
The filter’s transfer function becomes
Eq. 4-10
with to ensure a maximum gain of unity at where
. The corresponding difference equation is
Eq. 4-11
In the third example we design a simple bandstop filter for rejecting a narrow band of unwanted frequencies. In addition to a pair of complex conjugate zeros at the appropriate frequencies a pair of complex conjugate poles is placed close to these zeros. Then over most of the frequency range the pole and zero vectors are almost identical in length, and the response is close to unity. Only in the immediate vicinity of the zero vector becomes
much shorter than the pole vector, producing a narrow notch, see Figure 4.5. (compare with
2d 2 1 r– =
2 1 r–
2 1 r– 40= giving r 0.961=
0 = z 1=
Figure 4.4. Pole-zero configuration and magnitude response of a simple bandpass filter.
H z K z 1– z 1+ z rj– z rj+
-------------------------------------K z2 1–
z2 r2+-----------------------
K 1 z 2–– 1 r2z 2–+
-------------------------= = =
K 0.03824= z j=
H j 2K 1 r2– =
y n r2y n 2– + K x n x n 2– – =
0=
Digital Signal Processing Design of recursive (IIR) filters
versie 1.1 4-5 2012
Figure 4.2.b).
4.2 Filters derived from analog designsContinuous time filters are defined by differential equations:
Eq. 4-12
The role of the z-transform in the discrete time domain is played by the Laplace transform in the continuous time domain, and the substitution is equivalent to . It
follows that the imaginary axis ( ) in the s-plane corresponds to the unit circle in the z-
plane.
Using the Fourier transform property we find for the
frequency response function
Eq. 4-13
whereas the transfer function can be described in the general form
Eq. 4-14
where the filter is characterized by its poles and zeros which can be
plotted in the complex s-plane.One of the most effective ways of converting an analog filter into a digital filter is by means of the bilinear transformation. But first we summarize the characteristics of two important types of analog filters. The magnitude functions are given by
Figure 4.5. (a) Poles and zeros of a ‘notch’ filter; (b) response of a notch design for rejecting mains-supply interference from an EKG signal.
ak tk
k
dd
y t
k 0=
N
bk tk
k
dd
x t
k 0=
M
=
X s z ej s js j=
tdd
x t jX sX s =
H Y X ------------ bk j k
k 0=
M
ak j k
k 0=
N
= =
H s K s z1– s z2–
s p1– s p2– -----------------------------------------------=
p1 p2 z1 z2
Digital Signal Processing Design of recursive (IIR) filters
versie 1.1 4-6 2012
Eq. 4-15
where n is the filter order and is the nominal cut-off frequency. is the so-called
Chebyshev polynomial of nth order. It oscillates between 0 and 1 in the passband (if ),
rising to large values in the stopband. The amount of passband ripple is related to the
parameter by the expression
Eq. 4-16
Chebyshev polynomials may be generated from the recursion formula
Eq. 4-17
4.2.1 The bilinear transformation
Let us consider the complex function
Eq. 4-18
which is ‘bilinear’ in the sense that its numerator and denominator are both linear in z. Substituting we obtain
Eq. 4-19
when then , so it maps the unit circle on the axis. The complete
response of an analog filter is generated as varies from 0 to . If we substitute
H 11------ 2n
+ 1 2/–
= Butterworth
H 1 2Cn2 1------ +
1 2/–= (Chebyshev)
1 Cn
n 0
Figure 4.6. Typical frequency response (magnitude) functions of Butterworth and Chebyshev analog low-pass filters.
1 1 2+ 1 2/––=
Cn x 2xCn 1– x Cn 2– x –= C0 x 1= C1 x x=
F z z 1–z 1+-----------=
z ej=
F ej 1–ej 1+-----------------
2j 2 sin2 2 cos----------------------------- j
2---- tan= = =
0 0 F j
Digital Signal Processing Design of recursive (IIR) filters
versie 1.1 4-7 2012
for in the transfer function of Eq. 4-14 we obtain a function
in which the complete frequency response of the analog filter is compressed into the
range . The compression of the frequency scale is nonlinear. The shape of the
function means that the compression, or ‘warping’, effect is very small near ; but it
increases dramatically as we approach .
The bilinear transformation preserves the ‘maximally flat’, or ‘equiripple’, amplitude properties of the filters when the frequency axis is compressed. There is no aliasing of the analog frequency response. Thus the response of a low-pass filter falls to zero at .
The magnitude responses of the low-pass digital filters derived from Eq. 4-15 are given by
Eq. 4-20
A Butterworth low-pass digital filter of nth order has n poles arranged on a circular locus in the z-plane, and an nth order real zero at . The poles are given by the values of
falling inside the unit circle, where the real and imaginary of are respectively
Eq. 4-21
where
Eq. 4-22
and . If n is even the terms are replaced by .
An example is the design of a Butterworth low-pass filter with a cut-off frequency which response should be at least 30 dB down at .
Substituting and into Eq. 4-20 gives
Eq. 4-23
Now -30 dB corresponds to a response ratio (using
). Hence we find or . Since
the filter order must be integer, we choose . The pole locations found from
Eq. 4-21 and Eq. 4-22 are , and .
They are sketched in Figure 4.7.A convenient way to derive the filter’s difference equation is to treat it as a cascaded set of
F j 2 tan= s j=
H 0 tan
0=
=
=
H 1 2 tan1 2 tan
--------------------------- 2n
+ 1 2/–
= Butterworth
H 1 2Cn2 2 tan
1 2 tan--------------------------- +
1 2/–= (Chebyshev)
z 1–= Pm
Pm
PRm 1 1 2 tan2– d=
PIm 2 1 2 m n sintan d=
d 1 2 1 2 m n costan– 1 2 tan2+=
m 0 1 2n 1– = m n 2m 1+ 2n
1 0.2= 0.4=
1 0.2= 0.4=
H 0.4 10.2 tan0.1 tan
------------------------ 2n
+ 1 2/–
1 2.236 2n+ 1 2/–= =
H 10 3 2/–=
30– 20 H log= 1 2.236 2n+ 103 1000= n 4.29n 5= r
0.50953 00 0.83221 34.6440 0.59619 23.1250
Digital Signal Processing Design of recursive (IIR) filters
versie 1.1 4-8 2012
first and second order subfilters, as shown in Figure 4.7.b. We will distribute the five zeros at equally over the first and second order subfilters resulting in terms and
. The transfer function of the first order subfilter then takes the form
Eq. 4-24
with . It gives the difference equation
Eq. 4-25
Each second-order subfilter has a transfer function of the form
Eq. 4-26
yielding a difference equation
Eq. 4-27
The three difference equations can be used together, or alternatively a single high-order difference equations involving just x and y can be derived.From a low-pass filter a bandpass filter can be derived analogous to Eq. 3-9: multiplication with , which means convolution in the frequency domain with the Fourier
transform thereof (two -functions at ). This can be viewed as rotation by of poles in
the z-plane and addition of the complex conjugates, thus going from order n to 2n.
Figure 4.7. A 5th-order Butterworth low-pass digital filter.
z 1–= z 1+ z 1+ 2
V z X z -----------
z 1+z –------------=
0.50953=
v n v n 1– x n x n 1– + +=
W z V z ------------
z 1+ 2
z rej– z re j– – ------------------------------------------------
z2 2z 1+ +z2 2r cos– r2+---------------------------------------------= =
w n 2r cos w n 1– r2w n 2– – x n 2x n 1– x n 2– + + +=
n0 cos
0 0
Digital Signal Processing Design of recursive (IIR) filters
versie 1.1 4-9 2012
Suppose we require a bandpass filter with a lower cut-off frequency and an upper cut-off
frequency , and center frequency . We start with finding the poles
and zeros of a low-pass prototype with cut-off frequency . A pole (or zero)
located at then gives two poles (or zeros) in the bandpass design, at locations
Eq. 4-28
where . The zeros of the low-pass filter at
are converted by Eq. 4-28 to .
4.2.2 Impulse invariant filters
In this case the design criterion is that the impulse response of the digital filter should be a sampled version of that of the reference analog filter. Sampling of an analog signal causes repetition of its spectrum. This is illustrated in Figure 4.9.To avoid extensive aliasing an adequate sampling rate is necessary (part (b)). The effect of halving the sampling rate is illustrated in part (c). The effectiveness of the impulse invariant technique depends on an adequate sampling rate, and on choosing an analog reference filter with a limited bandwidth.
Recall that is equivalent to T, where T is the sampling interval. Hence in part (b) the value corresponds to , whereas in part (c) it corresponds to .
The starting point of a recursive design technique is the transfer function of the reference analog filter Eq. 4-14. Assuming there are no repeated poles we use the partial fraction expansion to express in the following parallel form
Eq. 4-29
In effect we are decomposing the analog filter into a set of single pole subfilters, whose outputs are added together. The impulse response of each analog subfilter takes a simple
2
3 0 3 2+ 2=
1 3 2–=
z =
z 0.5A 1 + 0.5A 1 + 2 –=
A 3 2+ 2 cos 3 2– 2 cos=
z 1–= z 1=
Figure 4.8. A 10th-order Chebyshev bandpass filter.
= T1= T2=
H s
H s Ki
s pi–------------
i=
Digital Signal Processing Design of recursive (IIR) filters
versie 1.1 4-10 2012
exponential form
Eq. 4-30
The impulse response of the impulse invariant digital subfilter is therefore ,
where T is the chosen sampling interval. This gives us
Eq. 4-31
with transfer function
Eq. 4-32
The overall digital filter is now built up as a parallel set of subfilters, as shown in Figure 4.10.As an example we calculate the impulse invariant digital equivalent of an analog third order Butterworth low-pass filter with a cut-off frequency of 1 radian/second, which transfer function is
Eq. 4-33
with . Given a sampling interval we find using Eq. 4-32
Figure 4.9. The idea of impulse-invariance.
hi t Kie
pit
0
=t 0t 0
hi n hi nT =
hi n Kie
piTn
0
=n 0n 0
Hi z KiepiTnz n–
n 0=
Ki
1 epiTz 1––-------------------------
Kiz
z epiT–-----------------= = =
H s 1s 1+ s p1– s p1
– ---------------------------------------------------------=
p1 0.5– 0.866j–= T 0.5=
Digital Signal Processing Design of recursive (IIR) filters
versie 1.1 4-11 2012
Eq. 4-34
with . The filter can be either implemented in this form, as parallelled
first and second order subsystems; or we can convert into the series form, using
Eq. 4-35
Figure 4.10. Designing an impulse-invariant filter by parallel decomposition.
H z zz e 0.5––-------------------
Kz
z e0.5p1–---------------------
Kz
z e0.5p1–
-----------------------+ +=
K 0.5– 0.2887j+=
H z 0.087z z 0.73+ z3 2.02z2– 1.46z 0.37–+--------------------------------------------------------------=
Figure 4.11. Responses of 3rd-order Butterworth low-pass filters designed by (a) impulse-invariance, and (b) the bilinear transformation.
Digital Signal Processing Design of recursive (IIR) filters
versie 1.1 4-12 2012
Figure 4.12. (a) Pole-zero configuration, and (b) impulse response of an impulse-invariant Butterworth low-pass filter.
Digital Signal Processing Design of recursive (IIR) filters
versie 1.1 4-13 2012
4.3 Frequency sampling filtersThe frequency sampling method is an example of a DSP technique developed from basic principles. It also produces FIR filters which offer the advantage of a linear-phase response.We start by considering a digital resonator having a complex conjugate pole-pair on the unit circle in the z-plane, and a second order zero at the origin.The impulse response of a resonator is given by
Eq. 4-36
with transfer function
Eq. 4-37
An infinite impulse response has transfer function
Eq. 4-38
corresponding to the difference equation
Eq. 4-39
An example with is shown in Figure 4.13.
As it stands such a resonator is not a useful processor, because it is unstable. However, its impulse response can be made finite by cascading with a very simple form of nonrecursive filter, known as the comb filter. The combination of comb filter and resonator provides the basic building block for a complete frequency sampling filter.The comb filter is described by the difference equation
Eq. 4-40
with transfer function
Eq. 4-41
giving m zeros spaced uniformly around the unit circle. These produce a comb frequency response, illustrated in part (c) for the case when . The overall pole-zero
configuration of comb filter and resonator is shown in part (d). The poles of the resonator are exactly cancelled by two of the comb filter’s zeros. The recursive difference equation is
Eq. 4-42
which requires only three additions/subtractions. A nonrecursive realization would need many
h n n sin u n 12j----- ejn e jn–– u n = =
H z 12j-----
11 ejz 1––-----------------------
11 e j– z 1––-------------------------–
z 1– sin
1 ejz 1–– 1 e j– z 1–– -----------------------------------------------------------= =
h n n cos u n =
H z z2
z ej– z e j–– ------------------------------------------
z2
z2 2 cos z– 1+-------------------------------------------= =
y n 2 cos y n 1– y n 2– – x n +=
cos 0.5=
y n x n x n m– –=
H z Y z X z ----------- 1 z m––
zm 1–zm
--------------= = =
m 24=
y n x n x n 24– – y n 1– y n 2– –+=
Digital Signal Processing Design of recursive (IIR) filters
versie 1.1 4-14 2012
more additions and subtractions. Part (e) shows that inclusion of the resonator converts the comb filter into an elementary bandpass characteristic. The center of the passband corresponds to the resonator pole locations. If the parameter m is increased, the width of the main passband reduces, and the characteristic tends to a , or sinc, function. Such a
filter forms the basis for a complete frequency-sampling filter.Suppose we require a digital filter with the response magnitude characteristic of Figure 4.14.a. We first sample it, as in Figure 4.14.b. The required response is now built up by superposing a set of sinc functions, each weighted by one of the sample values , and
arranged around it (Figure 4.14.c). Each of the sinc functions is provided by a comb filter-resonator combination. The complete frequency sampling filter uses a single comb filter which feeds all the resonators in parallel (Figure 4.14.d). Note that alternate weights must be inverted, because there is a phase reversal between the output of adjacent resonators. Two remarks are in order. First, the actual filter characteristic will always be an approximation to the desired one. The superposition of sinc functions does not give an exact replica of the
Figure 4.13. Basis of the frequency-sampling technique
x sin x
ai
Digital Signal Processing Design of recursive (IIR) filters
versie 1.1 4-15 2012
desired response, particularly near any sharp discontinuity. Second, if we attempt to place poles (and cancelling zeros) exactly on the unit circle, very small arithmetic errors may prevent exact cancellation and cause poles to move outside the unit circle.Thus for stability reasons poles and zeros are placed at a radius just less than unity.
4.4 Digital integratorsIntegration can be performed digitally if we assume that the signal samples represent an underlying analog waveform. In this section we consider several well-known integration algorithms as digital filtering operations, and compare their properties in the time and frequency domains.
Figure 4.14. Building up a complete frequency-sampling filter.
Digital Signal Processing Design of recursive (IIR) filters
versie 1.1 4-16 2012
4.4.1 Running sum
The simplest integration algorithm, with difference equation
Eq. 4-43
and corresponding transfer function and frequency response
Eq. 4-44
Eq. 4-45
4.4.2 Trapezoid rule
Eq. 4-46
Eq. 4-47
Eq. 4-48
4.4.3 Simpson’s rule
Eq. 4-49
Eq. 4-50
Eq. 4-51
4.4.4 Comparison
We may look on each of these methods as giving a polynomial approximation to the underlying analog signal. The running sum uses a zero-order polynomial, whereas trapezoid and Simpson’s rule are based on, respectively, a first- and second-order polynomial. This is illustrated in Figure 4.15.An ideal analog integrator would have a magnitude response inversely proportional to the
frequency, with a phase shift of because .
Pole-zero configurations of the three types of digital integrators are shown in Figure 4.16.All have a pole on the unit circle at , and the Simpson algorithm possesses another one
y n y n 1– x n +=
H z Y z X z -----------
11 z 1––----------------
zz 1–-----------= = =
H 11 e j– –-------------------
ej
ej 1–----------------= =
y n y n 1– 12--- x n x n 1– + +=
H z 1 2 1 z 1–+ 1 z 1––
------------------------------------z 1+
2 z 1– -------------------= =
H ej 1+2 ej 1– -------------------------=
y n y n 2– 13--- x n 4x n 1– x n 2– + + +=
H z 1 3 1 4z 1– z 2–+ + 1 z 2––
-----------------------------------------------------z2 4z 1+ +3 z2 1–
--------------------------= =
H e2j 4ej 1+ +3 e2j 1–
-------------------------------------=
2 t cos td t sin =
z 1=
Digital Signal Processing Design of recursive (IIR) filters
versie 1.1 4-17 2012
at . Therefore we plot the frequency response over a limited frequency range in Figure
4.17.
Figure 4.15. Digital integration: (a) the running-sum technique; (b) the trapezoid rule; (c) Simpson’s rule.
Figure 4.16. Pole-zero configurations of the running-sum, trapezoid and Simpson integrators.
z 1–=
Figure 4.17. Frequency responses of four digital integrators over the range . (a) Ideal; (b) running sum; (c) trapezoid; (d) Simpson.0.05 0.95
Digital Signal Processing Design of recursive (IIR) filters
versie 1.1 4-18 2012
The greatest differences are in the higher frequency part ( ). For example, if we need
to integrate a signal contaminated with random fluctuations or ‘noise’ (much of which is generally high frequency) it may be best to use the trapezoid rule, which will reduce the effects of the noise.
0.4
Digital Signal Processing Spectral analysis
versie 1.1 5-1 2012
5 Spectral analysis
5.0 IntroductionIn this chapter we return to the application of digital spectral analysis upon real world signals. With naturally occurring signals some applications involve searching for a wanted signal in the presence of unwanted disturbances or ‘noise’, on the basis of their different spectral distributions. Examples arise in the analysis of speech and biomedical signals such as the EKG (electrocardiogram). A different application is the measurement of the response of a system which is deliberately disturbed with a suitable input signal. Spectral analysis then yields information about the frequency dependent properties of the system. Examples hereof arise in testing of electronic circuits and filters, the analysis of vibrations in buildings and structures, and in radar, sonar and seismology. In chapter 1 we have discussed sampling, aliasing and (spectral) leakage. Here we continue our discussion of leakage, discuss spectral resolution, and present some examples which illustrate the effects of windowing and zero-padding.
5.1 Spectral leakageSpectral analysis with the discrete Fourier transformation (DFT) means discrete time and discrete frequencies, so a limited time observation window, which is repeated to obtain a periodic time-signal, in order to apply the DFT.The DFT of a signal that contains only harmonic frequencies (multiples) of the fundamental frequency , results in a line spectrum. The DFT of a signal that contains
frequencies which are not harmonic frequencies of the fundamental frequency gives a widening of the spectral lines, this widening is called leakage. The origin lies again in the finite length of the sum over N. Mathematically this can be regarded as the result of “windowing”. An alternative explanation for leakage which gives valuable insight into the nature of the DFT, is to regard the DFT as a type of filtering process. A DFT behaves like a set of elementary bandpass filters which split the signal into its various frequency components. This is illustrated in Figure 5.1. It is important to notice that the peak response of each filter coincides with zero response in its neighbours. Figure 5.1.a does not give the complete picture, because each elementary filter characteristic has substantial sidelobes to either side of its main lobe. As the transform length increases, each characteristic tends to a sinc function (Figure 5.1.b). The width of its main lobe is radians, the sidelobes are radians
wide, with amplitudes decreasing away from the center frequency . Note that the zero
crossings coincide with the center frequencies of the other filters. Thus, a signal component at an exact harmonic frequency only produces an output from one of the filters. If a component is displaced slightly from the filter’s center frequency, it gives a smaller peak response, plus a whole series of sidelobe responses from adjacent filters. This spectral leakage effect is illustrated in Figure 5.2. Increasing N, the number of FFT filters, will increase the frequency resolution in proportion. If we wish to resolve closely-spaced frequency components, we must work with a long portion of signal. Furthermore, increasing N will decrease the leakage, since a nonharmonic
0 2 N=
4 N 2 Nc
Digital Signal Processing Spectral analysis
versie 1.1 5-2 2012
frequency (like in Figure 5.2.) will usually become closer to a filter center frequency, and the leakage will extend over a more limited portion of the frequency domain.
Spectral analysis may provide a useful method for detecting a signal in the presence of noise. Suppose we believe the data shown in Figure 5.3.a contains a periodic square wave buried in noise. The transform in Figure 5.3.b shows a pronounced peak at the 32nd harmonic, and a lesser peak at the 96th harmonic. Now random noise in which successive time-domain samples are statistically independent has a flat spectrum, the individual spectral lines displaying chance amplitude variations. The FFT is consistent with the view that the time domain data consist of white noise, plus a signal which is strong in the 32nd and 96th harmonics. This is probably a square wave with a fundamental frequency corresponding to the FFT’s 32nd harmonic. The reason for the FFT’s success in this example is that the signal’s spectral energy is well concentrated, whereas the noise is wideband. Such techniques are likely to be valuable whenever signal and noise have
Figure 5.1. An 8-point DFT considered as a set of elementary bandpass filters.
Figure 5.2. Spectral leakage effects for (a) component lying midway between two harmonics, and (b) component lying a quarter of the way between two harmonics.
Digital Signal Processing Spectral analysis
versie 1.1 5-3 2012
substantially different spectral distributions.
5.2 WindowingA signal observed during a limited time window may be seen as the signal multiplied by a rectangular window (Eq. 156, Eq. 3-17). It follows that time-domain windowing causes the spectrum of the ‘raw’ signal to be convolved with that of the window. The rectangular, or ‘do-nothing’, window has the narrowest possible main lobe, but large, sinc-function side lobes. It causes no spreading of exact harmonic components, but it produces a lot of spectral leakage with non-harmonics (Figure 5.2.). As we learned in our discussion of truncating an infinite impulse response to arrive at a FIR filter in section 3.3 a variety of other windows exist. They all involve a different trade-off between a narrow main spectral lobe (to prevent local spreading of the spectrum), and low sidelobe levels (to reduce distant spectral leakage). This is illustrated in Figure 5.4. The signal contains an exact harmonic (the 9th), two closely spaced exact harmonics (the 51st and 53th) and a non-harmonic (midway between the 24th and 25th). The magnitudes of the FFT are shown on the right. With the rectangular window (Figure 5.4.a) the harmonics stand out clearly as single spectral lines, however there is a lot of distant leakage around the non-harmonic component. With the triangular window (Figure 5.4.b) the individual spectral lines have broadened, and there are significant sidelobes. The 51st and 53th harmonic terms can hardly be disentangled. However, leakage around the non-harmonic component has been considerably reduced. With the Hamming window (Figure 5.4.c) distant leakage is dramatically reduced compared to Figure 5.4.b. This is because of the low sidelobe levels of the Hamming function (see also Figure 3.9.). The effect of tapering just the ends of the data are shown in Figure 5.4.d. Note that it is now easier to distinguish the close-spaced 51st and 53th harmonics, but there is generally more spectral leakage than in Figure 5.4.c. In conclusion, spectral analysis and windowing are rather complicated. In some cases it may be best to leave the data alone (rectangular, or ‘do-nothing’, window), for example if a signal has close spaced components of roughly the same magnitude. Conversely, if the amplitudes are very different, a window with low side lobes will reduce leakage around the large component, and should make the small one easier to detect. Finally, it is very important to remember that sensible interpretation of an FFT depends on knowing what form of window
Figure 5.3. Using the FFT to detect a signal in noise.
Digital Signal Processing Spectral analysis
versie 1.1 5-4 2012
has been used.
5.3 Investigating LTI systemsThe investigation of an LTI system by means of FFT analysis is summarized in Figure 5.5.
A wideband input signal disturbs the system under test, and its output or response
is recorded. (By wideband it is meant that must contain a significant amount of
all frequencies likely to be transmitted by the system. Only if this condition is met can we
Figure 5.4. The use of windows in FFT analysis: (a) rectangular; (b) triangular; (c) Hamming, and (d) Hamming applied to the first and last 20 values.
Figure 5.5. Using the FFT to explore system properties.
x n y n x n
Digital Signal Processing Spectral analysis
versie 1.1 5-5 2012
expect to characterize the system completely.) FFT analysis of the output signal gives the output spectrum, which after division by the input spectrum yields the system’s frequency response. Thus:
Eq. 5-1
The simplest implementation of Eq. 5-1 involves using an input impulse. The output is then the impulse response, which transforms directly to the frequency response. When this is practically impossible, a step input may be preferred. Of course we cannot expect the impulse response of a system being investigated to have a number of sample values equal to an exact integer power of 2 needed to perform an FFT. So the usual approach is to add zeros to the time-domain data to bring it up to the required length. The addition of zeros is referred to as zero-filling or zero-padding. Figure 5.6. shows the typical effects of zero filling. The impulse response represents an LTI system with
close-spaced humps or ‘resonances’ in its frequency response, and is therefore useful for illustrating spectral resolution. Note that this has about 180 sample values of
significant size. In Figure 5.6.a it is zero-filled up to 256 points. The magnitude of the FFT displays two frequency response peaks, and also responds significantly around zero frequency (DC). A 180-point DFT or FFT would give a frequency response with slightly lower resolution, but the same ‘envelope’. The harmonic frequencies would be multiples of
, rather than radians. Figure 5.6.b shows the effect of zero filling up to 512
points. In the frequency domain the number of spectral lines and resolution have doubled, thus ‘oversampling’ the ‘envelope’. Although this does not improve the basic information content of the frequency response, it may aid interpretation. For instance, in Figure 3.3. the plots of
are greatly oversampled. However, when a 5-term moving average impulse response
is transformed by a 5-point DFT, the impulse response is constant, resulting in only one nonzero coefficient of the transform at zero frequency, see Figure 5.7.. The other frequency
domain samples coincide with nulls (at ). We conclude that although
such a DFT is theoretically adequate, it may be unhelpful for visualizing the detailed shape of a response.
Of course, these comments on zero-filling (made in the context of impulse responses and LTI
H k Y k X k -----------=
h n
h n
2 180 2 256
H
Figure 5.7. (a) 5-term moving average impulse response, with its (b) 5-point DFT magnitude.
n 0=
h n
a) b) 0=
1/5
4 5=
1.0H
2 5 4 5=
Digital Signal Processing Spectral analysis
versie 1.1 5-6 2012
systems) are also valid for the analysis of digital signals.
Finally, Figure 5.6.c illustrates the 128-point FFT of the truncated . The time function is
now only an approximation to the true impulse response, leading to errors in the spectral function. The truncated version of displays sudden discontinuities when repeated end-
on-end, producing spectral leakage. Spectral resolution has been halved (compared to Figure 5.6.a), making interpretation more difficult.
Figure 5.6. Effects of zero-filling on spectral resolution.
h n
h n
Index
Digital Signal Processing 2012
Numerics-3 dB point 4-3AADC 1-3aliasing 1-33, 4-7, 4-9ambiguity 1-5analog filter 4-5, 4-9Bbandpass filter 3-3, 4-3, 4-8bandstop filter 4-4bilinear transformation 4-5Butterworth 4-6Ccascade 2-7, 4-2, 4-7causal signal 2-2Chebyshev polynomial 4-6comb filter 4-13complex conjugate pair 4-2continuous signal 1-3convolution 1-27, 2-4convolution integral 1-11convolution sum 1-9DDAC 1-3decibel (dB) 3-6DFT 1-36digital resonator 4-13digital signal processing 1-3Dirichlet conditions 1-20Discrete Fourier Transform 1-16, 1-38discrete signal 1-3DSP 1-3Eeigenfunctions 1-13, 1-19, 1-20, 2-1exponentially decaying signal 2-2, 2-7FFast Fourier Transform 1-38feedback 4-1FFT 1-39final value theorem 2-5FIR (finite impulse response) 3-1first order difference (FOD) 3-11Fourier series 1-12, 1-20Fourier transform 1-24, 1-32, 2-1frequency sampling 4-13fundamental frequency 1-5, 1-37, 5-1
GGibbs phenomenon 1-24HHamming window 3-8, 3-9, 5-3Hanning window 3-8IIdealized filter frequency response 3-1impulse response 1-9, 1-11initial value theorem 2-5KKaiser window 3-9LLaplace transform 4-5leakage 1-37, 5-1linear time-invariant systems 1-8linear-phase 3-1, 4-1, 4-13low-pass filter 3-3, 3-4LTI 1-8LTI system 5-4Mminimum error approximation 1-23modulation 1-16, 1-27Nnoise 4-18, 5-2notch filter 4-4Nyquist 1-33Ooverdrachtsfunctie 1-16oversampling 5-5overshoot 1-24Pparallel 4-10, 4-14Parks and McClellan 3-10Parseval’s theorem 1-17, 1-28partial fraction expansion 2-4, 4-9passband 4-3passband-stopband transition 3-8periodic convolution 1-16phase distortion 3-1, 4-1Rreconstruction filter 1-34rectangular window 3-6, 5-3region of convergence (ROC) 2-2resolution 5-5resonator 4-13ringing 3-5ripple 3-8, 3-9, 3-10
Index
Digital Signal Processing 2012
Ssampling 1-32, 4-9sampling frequency 1-33sampling theorem 1-33selectivity 2-9Shannon 1-33sidelobe 3-6, 5-3sinc function 1-26, 4-14spectral analysis 1-36stability 4-15steady state response 2-6Ttapering 5-3time delay 3-1time shift 1-17, 1-27, 2-3time-invariant 1-8transfer function 1-16, 2-4triangular window 3-6, 5-3Uunilateral z-transform 2-2VVon Hann window 3-8Wwideband 5-4window 1-33Zzero-filling 5-5zero-padding 5-5