Digital Signal Processing Notes-1 PDF
Digital Signal Processing Notes-1 PDF
ON
I. Introduction
Introduction to Digital Signal Processing: Discrete time signals & sequences, Linear shift
invariant systems, Stability, and Causality, Linear constant coefficient difference equations,
Frequency domain representation of discrete time signals and systems.
Contents:
Sampling theory
Discrete-time signals
Transformation of the independent variable
Discrete-time systems
Linear constant coefficient difference equations
Fourier analysis of discrete-time signals and systems
Frequency response of discrete-time system
Properties of the discrete-time Fourier transform (DTFT)
1 of 77
Sampling theory
Illustrative example A continuous-time random signal is shown. Based on this several
important concepts are shown below. The signal is a continuous-time signal with continuous
amplitude. Such a signal is also called an analog signal.
x(t)
+
t
0
x(t)
4 8
3 7
2 6
1 5
0 4 Time
–1 3
–2 2
–3 1
–4 0
nT 0 1T 2T 3T 4T 5T 6T 7T 8T Time
n 0 1 2 3 4 5 6 7 8
x(n) 5.5 2.8 3.8 5.3 1.5 4.6 8.4 6.9 7.3 Sampled signal. Discrete-time
signal – time is discrete,
amplitude is continuous.
5 2 3 5 1 4 6 7 Quantized. Quantization noise
7 (error). Digital signal – both
time and amplitude are discrete.
101 010 011 101 001 100 111 110 111 Encoded to 3 bits/sample.
Note this particular point exhibits saturation (out of
range). Rounded down to 7, not 8.
If we were to represent every sample value with infinite precision (for example, x(1) = 2.8--,
instead of being approximated as 2 or 3) then we would need registers and memory words of
arbitrarily large size. However, owing to a finite word length we round off the sample values (in
this case x(1) = 2.8-- will be rounded to 2). This introduces quantization noise or error.
2 of 77
The procedure of generating a discrete-time signal from an analog signal is shown in the
following block diagram. In the digital signal processing course we are mostly dealing with
discrete–time rather than digital signals and systems, the latter being a subset of the former.
Sample
(& Hold) Quantizer Encoder
The three boxes shown above can be represented by an analog to digital converter
(ADC). A complete digital signal processing (DSP) system consists of an ADC, a DSP algorithm
(e.g., a difference equation) and a digital to analog converter (DAC) shown below.
As the name implies discrete-time signals are defined only at discrete instants of time.
Discrete-time signals can arise by sampling analog signals such as a voice signal or a
temperature signal in telemetry. Discrete-time signals may also arise naturally, e.g., the number
of cars sold on a specific day in a year, or the closing DJIA figure for a specific day of the year.
AT&T’s T1 Stream The voice signal is band limited to 3.3 kHz, sampled at 8000 Hz (8000
samples per second), quantized and encoded into 8 bits per sample. Twenty four such voice
channels are combined to form the T1 stream or signal.
1
Sampling interval = = 0.125 msec.
8000 Hz
samples bits
Bit rate for each channel = 8000 x8 = 64000 bits/sec.
sec sample
Bit rate for T1 = 64000 bits/sec per channel x 24 channels = 1 544 000 bits/sec.
Commercial examples CD, Super Audio CD (SACD), DVD Audio (DVD-A), Digital audio
broadcasting - 32 kHz, and Digital audio tape (DAT) - 48 kHz.
3 of 77
Pulse-train sampling For pulse-train sampling of the signal x(t) by the rectangular pulse-train
p(t) resulting in the sampled signal xs(t), we have
Thus
xs(t) = C
n
n x(t)e j n 2 Fs t
The Fourier spectrum of xs(t) is given by
j 2 F t
Xs(F) = x (t)e
s dt = C
n x(t)e j n 2 Fs te j 2 F t dt
Interchanging the order of integration and summation yields the aliasing formula
C x(t) e dt =
C X (F nF )
n n s
Xs(F) =
j 2 ( F nFs ) t
n n
x(t)
t
0 T 2T 3T
p(t) τ
1
t
0 T 2T 3T
The sampled signal spectrum Xs(F) is sketched below. For convenience of illustration we
have assumed the base band spectrum, X(F), to be real valued; the maximum value of |X(F)| is
taken to be 1. Xs(F) consists of replicas of X(F), scaled by the Fourier coefficients Cn and
repeated at intervals of Fs. Specifically, the replica at the origin is simply X(F) scaled by C0.
Note that the magnitudes, |Cn|, have even symmetry. In this case, since FM ≤ Fs–FM, there is no
overlap among the replicas in the graph of Xs(F). As a result the original signal x(t) can be
4 of 77
recovered by passing xs(t) through a low pass filter with a bandwidth B that satisfies the
condition FM ≤ B ≤ Fs–FM, and a gain of 1/C0.
X(F)
F
–FM 0 FM
Xs(F)
Gain = 1/C0 Bandwidth = B
C–1 C0 C1
F
–Fs –FM 0 FM Fs–FM Fs Fs+FM
Impulse-train sampling If p(t) is an impulse-train then the Fourier coefficients are given by
T/2
1 j n 2 Fs t
1
T T/ 2
Cn = (t)e dt = . 1 = Fs for all n
T
so that the aliasing formula becomes
Xs(F) = Fs X (F nF )
n
s
Alternative derivation It can be shown that
s X ( j( n
Note that some use the notation X(Ω) instead of X(jΩ), so that the above equation is written as
Xs(Ω)= s X ( ns ) = Fs X ( ns )
2 n n
About terminology The highest frequency in the signal is called the Nyquist frequency. The
minimum sampling rate that, in theory, allows perfect signal recovery is called the Nyquist rate.
Thus Nyquist rate is twice the Nyquist frequency.
A signal, however, is generally sampled at more than twice the Nyquist frequency. One
half the sampling rate is called the folding frequency. As an example, if a voice signal is band
limited to 3.3 kHz and sampled at 8 kHz then the Nyquist frequency = 3.3 kHz, the Nyquist rate
= 6.6 kHz, and the folding frequency = 4 kHz.
To add to the ambiguity, some references use the phrase Nyquist frequency to refer to
one half the sampling rate.
5 of 77
Aliasing Illustration using a signal spectrum band-limited to 4 kHz and a sampling rate of 8 kHz.
The signal is perfectly band-limited to 4 kHz so that there is no overlapping in the spectrum of
the sampled signal.
F, Hz
–8k –4k 0 4k 8k 12k
Xs(F)
F, Hz
–8k –4k 0 4k 8k 12k
X(F)
F, Hz
–8k –4k 0 4k 8k 12k
1k signal
7k signal
The signal has a genuine, desirable, 1 kHz component. Since it is not perfectly band-limited to 4
kHz it has another genuine but undesirable 7 kHz component. Due to the first pair of replicas
(centered at 8 kHz and –8 kHz) this 7kHz component appears as if it were a 1kHz component –
in other words the 7 kHz component is an alias of 1kHz. Thus the first (lowest) alias of the 1 kHz
frequency is given by 8 kHz – 1 kHz = 7 kHz.
Due to the second pair of replicas at 16 kHz and –16 kHz the 15k component in the
original signal also appears as if it were a 1k component – it is another alias of the 1k. This
second alias of the 1 kHz frequency is given by 16 kHz – 1 kHz = 15 kHz. The next alias is (3 x
8 – 1) kHz = 23 kHz.
In general, for any frequency F1 within the base band (in this case any frequency from 0
to 4000 Hz) its aliases are given by
F2 = kFs – F1, k = 1, 2, …
Setting k = 1 gives the lowest alias of F1, that is, F2 = 1 x 16 – 4 = 12 Hz. The next alias is 2 x 16
– 4 = 28 Hz. Consider two waveforms with frequencies of 4 Hz and 12 Hz given by
n 0 1 2 3 4 5 6 7
x1(n) 1 0 –1 0 1 0 –1 0
x2(n) 1 0 –1 0 1 0 –1 0
These two sequences are seen to have the same digital frequency and cannot be distinguished
from each other as far as the frequency is concerned. When passed through a smoothing filter,
they will both appear as 4 Hz signals. This is true even if the amplitudes of the underlying analog
waveforms are different.
7 of 77
In MATLAB
%Plot x1(t) = cos 2π4t as t goes from 0 to 0.5 sec (2 cycles) in steps of T = 1/160 sec.
t = 0: 1/160: 0.5; x1 = cos (2*pi*4*t); plot(t, x1)
%Plot x1(n) = cos nπ/20 as n goes from 0 to 80 (2 cycles) in steps of 1 (T = 1/160 sec.)
n = 0: 1: 80; x1 = cos (n*pi/20); plot(n, x1, 'bo'); grid %Blue circles and grid
%Stem plot x1(n) = cos nπ/2 as n goes from 0 to 8 (2 cycles) in steps of 1 (T = 1/16 sec.)
n = 0: 1: 8; x1 = cos (n*pi/2); stem(n, x1)
%Titles, labels and grid. Stem plot x1(n) = cos nπ/20 as n goes from 0 to 80 (2 cycles)
%MATLAB won‟t accept the kind of single quote in title „Sampled Cosine‟
n = 0: 1: 80; x1 = cos (n*pi/20);
stem(n, x1); title(„Sampled Cosine‟); xlabel(„n‟), ylabel(„x1‟); grid
%Plot x1(t) = cos 2π4t as t goes from 0 to 0.5 sec (2 cycles) in steps of T = 1/160 sec.
t = 0: 1/160: 0.5; x1 = cos (2*pi*4*t); plot(t, x1)
0.8
0.6
0.4
0.2
-0.2
-0.4
-0.6
-0.8
-1
0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45 0.5
8 of 77
%Plot x1(n) = cos nπ/20 as n goes from 0 to 80 (2 cycles) in steps of 1 (T = 1/160 sec.)
n = 0: 1: 80; x1 = cos (n*pi/20); plot(n, x1, 'bo'); grid %Blue circles and grid
0.8
0.6
0.4
0.2
-0.2
-0.4
-0.6
-0.8
-1
0 10 20 30 40 50 60 70 80
Stem plot of x1 = cos (n*pi/20) – 4 Hz Cosine sampled at 160 samples per second
1
0.8
0.6
0.4
0.2
-0.2
-0.4
-0.6
-0.8
-1
0 10 20 30 40 50 60 70 80
9 of 77
Aliasing and digital frequency With Fs = 16 Hz the base band signal must be band-limited to 8
Hz. And we do not expect frequencies higher than 8 Hz. Consider the 3 signals x1(t), x2(t), and
x3(t) of frequencies 4Hz, 12Hz and 28Hz, respectively, where x2 and x3‟s frequencies are the
aliases of x1‟s. The continuous and discrete-time signals are given in table below with a sampling
rate of 16 samples/sec.
10 of 77
In MATLAB:
%Aliasing demo
%First---------------------------------------------
%Plot the continuous-time waveforms x1(t), x2(t), and x3(t) over a 1-second interval
t = 0: 1/500: 1;
x1 = cos (2*pi*4*t); %4 Hz
subplot(3, 1, 1), plot(t, x1, 'b'); %subplot(3, 1, 1) – 3 rows, 1 column, #1
xlabel ('Time, t, seconds'), ylabel('x1(t)');
title ('4 Hz')
grid;
%Second---------------------------------------------
%Plot the sequences x1(n), x2(n), and x3(n)
n = 0: 1: 16;
%4 Hz sampled at 16 Hz
x1 = cos (n*pi/2);
subplot(3, 1, 1), stem(n, x1, 'bo'); %subplot(3, 1, 1) – 3 rows, 1 column, #1
xlabel ('Sample number, n'), ylabel('x1(n)');
title ('4 Hz at 16 samples/sec')
grid;
%12 Hz sampled at 16 Hz
x2 = cos (3*n*pi/2);
subplot(3, 1, 2), stem(n, x2, 'ko'); %subplot(3, 1, 2) – 3 rows, 1 column, #2
xlabel ('Sample number, n'), ylabel('x2(n)');
title ('12 Hz at 16 samples/sec')
%28 Hz sampled at 16 Hz
x3 = cos (7*n*pi/2);
subplot(3, 1, 3), stem(n, x3, 'ro'); %subplot(3, 1, 3) – 3 rows, 1 column, #3
xlabel ('Sample number, n'), ylabel('x3(n)');
title ('28 Hz at 16 samples/sec')
%---------------------------------------------
11 of 77
4 Hz
1
x1(t) 0
-1
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Time, t, seconds
12 Hz
1
x2(t)
-1
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Time, t, seconds
28 Hz
1
x3(t)
-1
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Time, t, seconds
4 Hz at 16 samples/sec
1
x1(n)
-1
0 2 4 6 8 10 12 14 16
Sample number, n
12 Hz at 16 samples/sec
1
x2(n)
-1
0 2 4 6 8 10 12 14 16
Sample number, n
28 Hz at 16 samples/sec
1
x3(n)
-1
0 2 4 6 8 10 12 14 16
Sample number, n
12 of 77
Discrete-time signals
Definition A discrete-time signal is a sequence, that is, a function defined on the positive and
negative integers.
The sequence x(n) = xR(n) + j xI(n) is a complex (valued) sequence if xI(n) is not zero for
all n. Otherwise, it is a real (valued) sequence.
Examples of discrete-time signals represented in functional form are given below.
(Exercise: Plot these signals for several values of n.)
x1(n) = 2 cos 3n
x2(n) = 3 sin (0.2πn)
Alternatively, if a signal is non-zero over a finite (small enough) interval, we can list the
values of the signal as the elements of a sequence. For example
Definition A discrete-time signal whose values are from a finite set is called a digital signal.
(Omit) Discrete-time Energy and Power signals The energy E of a discrete-time signal x(n) is
given by
N
E = lim
N
x(n) x (n) *
nN
where x is the complex conjugate of x. If x(n) is a real sequence then x(n) x*(n) = x2(n). The
*
x(n)
2
E = lim (there are 2N+1 terms here)
N
nN
If E is finite but non zero (i.e., 0 < E < ∞) the signal is an energy signal. It is a power
signal if E is infinite but P is finite and nonzero (i.e., 0 < P < ∞). Clearly, when E is finite, P = 0.
If E is infinite P may or may not be finite.
If neither E nor P is finite, then the signal is neither an energy nor a power signal.
The terms “power” and “energy” are used independently of whether the
N t2
quantity x(n) (or, x(t) dt , in the continuous time case) actually is related to physical
2 2
n N t1
energy. Even if such a relationship exists, these quantities, (.) and (.), may have the wrong
dimensions and scaling. Still it is convenient to use these terms in a general fashion. It is helpful
to imagine that x(t) or x(n) is the voltage across, or, current through, a 1-ohm resistor.
13 of 77
Example 1.2.1 For the signal x(n) = 1 for all n,
N
Example 1.2.2 For the signal x(n) = n both E and P are infinite. This is neither an energy nor a
power signal.
(End of Omit)
14 of 77
Examples of discrete-time signals In these examples w(n) and z(n) take on only a finite number
of different values – hence digital. But x(n) and y(n) take on a countable infinite number of
values – they are not digital. (Figure)
w(n) x(n)
Periodic Positive n
n n
y(n) z(n)
Discrete-time Non-periodic digital
n n
15 of 77
Important discrete-time signals If a continuous-time signal x(t) is sampled at T-second
intervals, the result is the sequence {x(nT)}. For convenience we shall drop the T and the braces
and use just x(n) to represent the sequence.
δ(n) = 1, n = 0
0, n 0
Whereas δ(n) is somewhat similar to the continuous-time impulse function δ(t) – the
Dirac delta – we note that the magnitude of the discrete impulse is finite. Thus there are no
analytical difficulties in defining δ(n). It is convenient to interpret the delta function as follows:
δ(n) δ(n–k)
1 1
n n
–1 0 1 –1 0 1 k
u(n) = 1, n0
0, n<0
u(argument) = 1, if argument 0
0, if argument < 0
u(n) u(n–k)
1 1
n n
–1 0 1 –1 0 k
a) The discrete delta function can be expressed as the first difference of the unit step function:
16 of 77
0 if
(k ) =
n n 0
= u(n)
k 1 if n 0
Sum up to here is zero
k
n 0
k
0 n
Sum up to here is 1
Results (a) and (b) are like the continuous-time derivative and integral respectively.
u(n)
δ(n) δ(n–1) δ(n–2) δ(n–3)
n
0 1 2 3
that is, the multiplication will pick out just the one value x(k).
17 of 77
If we find the infinite sum of the above we get the sifting property:
x(n) (n k) = x(k)
n
x(n)
x(k)
n
0 k
δ(n–k)
n
0 k
x(k) δ(n–k)
x(k) δ(n–k)
n
0 k
x(n) = x(k) (n k)
k
3) The real exponential sequence Consider the familiar continuous time signal
18 of 77
x(t) = e t = et / , t0
The sampled version is given by setting t = nT
x(nT) = e nT = e T ,
n
nT 0
T
Dropping the T from x(nT) and setting e = a we can write
x(n) = a n , n0
The sequence can also be defined for both positive and negative n, by simply writing x(n) = an
for all n.
x(t) = e t , t 0
t
0 1 2 3 4 5 6
x(n) = an u(n)
1
a a = e T
a2
a3
a4
n
0 1 2 3 4 5 6
F0 and Ω0 are the analog frequency in Hertz (or cycles per second) and radians per second,
respectively. The sampled version is given by
We may write Ω0T = ω0 which is the digital frequency in radians (per sample), so that
Periodic signal The discrete-time signal x(n) is periodic if, for some integer N > 0
The smallest value of N that satisfies this relation is the (fundamental) period of the signal. If
there is no such integer N, then x(n) is an aperiodic signal.
Given that the continuous-time signal xa(t) is periodic, that is, xa(t) = xa(t+T0) for all t,
and that x(n) is obtained by sampling xa(t) at T second intervals, x(n) will be periodic if T0/T is a
rational number but not otherwise. If T0/T = N/L for integers N ≥ 1 and L ≥ 1 then x(n) has
exactly N samples in L periods of xa(t) and x(n) is periodic with period N.
Periodicity of sinusoidal sequences The sinusoidal sequence sin (2πf0n) has several major
differences from the continuous-time sinusoid as follows:
a) The sinusoid x(n) = sin (2πf0n) or sin (ω0n) is periodic if f0, that is, ω0/2π, is rational. If f0 is
not rational the sequence is not periodic. Replacing n with (n+N) we get
x(n+N) = sin (2πf0 (n+N)) = sin 2πf0n. cos 2πf0N + cos 2πf0n. sin 2πf0N
Clearly x(n+N) will be equal to x(n) if f0N = m, an integer or f0 = m/N. The fundamental period is
obtained by choosing m as the smallest integer that yields an integer value for N. For example, if
f0 = 15/25, which in reduced fraction form is 3/5, then we can choose m = 3 and get N = 5 as the
period. If f0 is rational then f0 = p/q where p and q are integers. If p/q is in reduced fraction form
then q is the period as in the above example.
On the other hand if f0 is irrational, say f0 = 2 , then N will not be an integer, and thus
x(n) is aperiodic.
Note: In expressions like sin n , sin 2fn , e j n and e j 2 f n we shall refer to ω or f as the
frequency even when the signal concerned is not periodic by the definition above.
b) The sinusoidal sequences sin ω0n and sin ((ω0+2 k)n) for 0 ω0 2π are identical. This can
be shown using the identity
Similarly, cos ω0n and cos ((ω0+2πk)n) are the same. Therefore in considering sinusoidal
sequences for analysis purposes, ω0 can be restricted to the range 0 ω0 π without any loss of
generality.
20 of 77
sin ω0n is the negative of sin ((2π–ω0)n), and
cos ω0n is the same as cos ((2π–ω0)n)
The sum of two discrete-time periodic sequences is also periodic. Let x(n) be the sum of two
periodic sequences, x1(n) and x2(n), with periods N1 and N2 respectively. Let p and q be two
integers such that
Odd and even sequences The signal x(n) is an even sequence if x(n) = x(–n) for all n, and is an
odd sequence if x(n) = –x(–n) for all n.
–2 2 2
n n
0 1 –2 0 1
x(n) x(n)
The even part of x(n) is determined as xe(n) = and the odd part of x(n) is given by
2
x(n) x(n)
xo(n) = . The signal x(n) then is given by x(n) = xe(n)+xo(n).
2
21 of 77
Example 1.2.3 Plot the sequences x1(n) = 2 cos n and x2(n) = 2 cos (0.2πn). What are their
“frequencies”? →hich of them is truly periodic and what is its periodicity?
Solution The MATLAB program segment follows:
N = 21; n = 0: N-1;
%
%Nonperiodic
x1= 2*cos(1*n);
subplot(2, 1, 1), stem(n, x1);
xlabel('n'), ylabel('x1'); title('x1 = 2 cos 1n');
%
%Periodic
x2 = 2*cos(0.2*pi*n);
subplot(2, 1, 2), stem(n, x2);
xlabel('n'), ylabel('x2'); title('x2 = 2 cos 0.2\pi n');
x1 = 2 cos 1n
2
1
x1
-1
-2
0 2 4 6 8 10 12 14 16 18 20
n
x2 = 2 cos 0.2 n
2
1
x2
-1
-2
0 2 4 6 8 10 12 14 16 18 20
n
22 of 77
Example 1.2.4 Plot the sequence x3(n) = 2(0.9)n cos 0.2 n .
Solution The MATLAB program segment follows:
n = [0: 30];
%
%“.^” stands for element-by-element exponentiation
%“.*” stands for element-by-element multiplication
x3 = 2* ((0.9) .^n) .*cos(0.2*pi*n);
stem(n, x3);
xlabel('n'), ylabel('x3'); title('Sequence x3(n)');
Sequence x3(n)
2
1.5
0.5
x3
-0.5
-1
-1.5
0 5 10 15 20 25 30
n
23 of 77
As in the case of continuous-time signals the operations of shifting and folding are not
commutative. In other words, the result of first shifting and then folding is not the same as that of
first folding and then shifting.
A third operation is scaling, of which more will be said in a later unit.
Example 1.3.1 [Delta function] Given the delta function δ(n), first reflect then shift (delay) by 2
units. The other possibility is first to shift (delay) by 2 units and then reflect.
The result of “reflect then shift” is shown below left. Reflect means to change the sign of
n; then shifting is done by replacing (n) by (n–2). The result is: (1) δ(n) δ(–n) and (2) δ(–n) =
δ(–(n)) δ(–(n–2)) = δ(–n+2).
δ(n) δ(n)
1 1
n n
0 0
δ(–n) δ(n–2)
[Reflected] [Delayed]
1 1
n n
0 0 2
1 1
n n
0 2 –2 0
To continue the example, the second possibility, the result of “shift then reflect” is shown above
right. Shift means replacing (n) by (n–2); then reflect by changing the sign of n. The result is δ(–
n–2). The result is: (1) δ(n) = δ((n)) δ((n–2)) and (2) δ((n–2)) = δ(n–2) δ(–n–2).
Note that the two end results are not the same. This serves to illustrate that the two
operations of shifting and reflecting are not commutative:
Fold(Shift(δ(n))) ≠ Shift(Fold(δ(n)))
24 of 77
Discrete-time systems
Definition A discrete-time system is a mapping from the set of acceptable discrete-time signals,
called the input set, to a set of discrete-time signals called the output set.
Definition A discrete-time system is deterministic if its output to a given input does not depend
upon some random phenomenon. If it does, the system is called a random (stochastic) system.
Definition A digital system is a mapping which assigns a digital output signal to every
acceptable digital input signal.
Filter Some refer to a linear time-invariant (LTI) system simply as a filter, that is, a filter is a
system T with a single input and a single output signal that is both linear and time-invariant.
Linearity
Definition A discrete-time system T[.] is linear if the response to a weighted sum of inputs x1(n)
and x2(n) is a weighted sum (with the same weights) of the responses of the inputs separately for
all weights and all acceptable inputs. Thus the system y(n) = T[x(n)] is linear if for all a1, a2,
x1(n) and x2(n) we have
Another way of saying this is that if the inputs x1(n) and x2(n) produce the outputs y1(n)
and y2(n), respectively, then the input a1x1(n) + a2x2(n) produces the output a1 y1(n) + a2 y2(n).
This is called the superposition principle. The a1, a2, x1(n) and x2(n) may be complex-valued.
The above definition combines two properties, viz.,
1. Find outputs y1(n) and y2(n) corresponding to inputs x1(n) and x2(n)
2. Form the sum a1 y1(n) + a2 y2(n)
3. Find output y3(n) corresponding to input a1x1(n) + a2x2(n)
4. Compare the results of steps 2 and 3
25 of 77
1. y(n) = x(n) + x(n–1) + x(n–2)
2. y(n) = y(n–1) + x(n)
3. y(n) = 0
4. y(n) = n x(n) (But time-varying)
1. y(n) = x2(n)
2. y(n) = 2 x(n)+3. This is a linear equation though! This system is made up of a
linear part, 2 x(n), and a zero-input response, 3. This is called an incrementally
linear system, for it responds linearly to changes in the input.
Example 1.4.1 Determine if the system y(n) = T[x(n)] = x(–n) is linear or nonlinear.
Answer Determine the outputs y1(.) and y2(.) corresponding to the two input sequences x1(n) and
x2(n) and form the weighted sum of outputs:
Check if (A) and (B) are equal. In this case (A) and (B) are equal; hence the system is
linear.
We can specify a1, a2, x1(n), x2(n) such that (A) and (B) are not equal. Hence nonlinear.
Example 1.4.4 Check the system y(n) = T[x(n)] = an cos(2πn/N) for linearity.
x(n) y(n) = an cos (2πn/N)
T[.]
Answer Note that the input is x(n). Clearly y(n) is independent of x(n). The outputs due to x1(n)
and x2(n) are:
The weighted sum of the outputs = b1 an cos (2πn/N) + b2 an cos (2πn/N) (A)
The output due to a weighted sum of inputs is
y3(n) = T[b1 x1(n) + b2 x2(n)] = an cos (2πn/N) (B)
(A) and (B) are not equal, so the system is not linear. (But (A) = (b1+b2) an cos (2πn/N) and this is
equal to (B) within a constant scaling factor.)
Example 1.4.5 Check the system y(n) = T[x(n)] = n x(n) for linearity.
x(n) y(n) = n x(n)
T[.]
Answer For the two arbitrary inputs x1(n) and x2(n) the outputs are
y1(n) = T[x1(n)] = n x1(n)
y2(n) = T[x2(n)] = n x2(n)
For the weighted sum of inputs a1 x1(n) + a2 x2(n) the output is
y3(n) = T[a1 x1(n) + a2 x2(n)]= n (a1 x1(n) + a2 x2(n))
= a1 n x1(n) + a2 n x2(n)
= a1 y1(n) + a2 y2(n). Hence the system is linear.
Shift-invariance (time-invariance)
Definition A discrete time system y(n) = T[x(n)] is shift-invariant if, for all x(n) and all n0, we
have: T[x(n–n0)] = y(n–n0).
This means that applying a time delay (or advance) to the input of a system is equivalent
to applying it to the output.
When we suspect that the system is time-varying a very useful alternative approach is to
find a counter-example to disprove time-invariance, i.e., use intuition to find an input signal for
28 of 77
which the condition of shift-invariance is violated and that suffices to show that a system is not
shift-invariant.
Answer Find output for x(n), delay it by n0, and compare with the output for x(n-n0). The output
for x(n) is
Example 1.4.10 Examine y(n) = T[x(n)] = x(n) + n x(n+1) for time invariance.
Answer Notice that the difference equation has a time-varying coefficient, n. The output y(n)
corresponding to x(n) is already given above. Delaying y(n) by n0 gives
Example 1.4.11 Check for time invariance of the system y(n) = T[x(n)] = n x(n).
Answer We shall do this by counterexample(s) as well as by the formal procedure. The formal
procedure is:
29 of 77
Alternative We expect that it is time varying since the equation has a time varying coefficient.
Find a counter example to show that the system is time varying. For input x(n) = (n), the output
is
y(n) = n δ(n) = 0 for all n
Thus while x(n–1) is a shifted version of x(n), y(n, 1) is not a shifted version of y(n). So the
system is time-varying.
y(n) = n u(n)
Example 1.4.12 Check for time invariance the system y(n) = T[x(n)] = cos (x(n)).
Answer The output y(n) corresponding to input x(n) is
Since (A) and (B) are equal we have y(n, n0) = y(n–n0). Therefore the system is time-invariant.
Example 1.4.13 The system y(n) = T[x(n)] = g(n) x(n) needs to be tested for time-invariance.
Answer Note that the coefficient g(n) is time-varying. Hence, the system is time-varying. The
output y(n) due to input x(n) is
(A) (B), i.e., y(n, n0) y(n–n0). Hence, the system is time-varying.
Example 1.4.14 Check for time–invariance the system y(n) = an cos (2πn/N).
Answer The output consists simply of a time-varying coefficient and is independent of the input
x(n). The output y(n) due to input x(n) is
30 of 77
y(n) = T[x(n)] = an cos (2πn/N)
(A) (B), that is, y(n, n0) y(n–n0). Hence, the system is time-varying.
(A) and (B) are not equal. Hence, the system is time-varying.
Answer This system represents time scaling. That is, y(n) is a time-compressed version of x(n),
compressed by a factor of 2. For example, the value of x that occurred at 2n is occurring at n in
the case of y. Intuitively, then, any time shift in the input will also be compressed by a factor of
2, and it is for this reason that the system is not time–invariant.
This is demonstrated by counter-example (Oppenheim & Willsky, p. 52). It can also be
shown by following the formal procedure, which we shall do first below. For the input x(n) the
output is
y(n) = T[x(n)] = x(2n)
(A) and (B) are not equal. So the system is not time-variant.
By counter example To show that the system y(n) = x(2n) is not time–invariant by way of a
counter example consider the x(n) below:
x(n) = 1, –2 ≤ n ≤ 2
31 of 77
0, otherwise
We shall show that y(n, 2) ≠ y(n–2). We express x(n) in terms of unit step functions as
Next we determine y(n, 2) by first obtaining x(n–2) and then the corresponding output y(n, 2):
x(n–2) x(n–2) = u((n–2)+2) – u((n–2)–3) = u(n) – u(n–5) = x2(n), say
y(n, 2) y(n, 2) = x2(2n) = u(2n) – u(2n–5)
We can easily sketch y(n, 2) and y(n–2) and see that y(n, 2) ≠ y(n–2), and therefore the system
y(n) = x(2n) is not time–invariant.
Alternatively, this can be done entirely graphically.
= x(k) (n k)
k
So the response of a linear system to input x(n) can be written down using the linearity
principle, i.e., linear superposition. For a linear shift-invariant system whose impulse response is
T[δ(n)] = h(n) the reasoning goes like this
For an input δ(n) the output is h(n). For an input x(0) δ(n) the output is x(0) h(n)
by virtue of scaling.
For an input δ(n–1) the output is h(n–1) by virtue of shift-invariance. For an input
x(1) δ(n–1) the output is x(1) h(n–1) by virtue of scaling.
Therefore for an input of x(0) δ(n) + x(1) δ(n–1) the output is x(0) h(n) + x(1) h(n–
1) by virtue of additivity.
This reasoning can be extended to cover all the terms that make up x(n). In general the
response to x(k) δ(n–k) is given by x(k) h(n–k).
Given that
32 of 77
we have
y(n) = T[x(n)] = T x(k) (n k)
k
Since T[.] is linear we can apply linearity a countable infinite number of times to write
In above equation since the system is shift-invariant we write T[δ(n–k)] = h(n–k). Else write
hk(n) or h(n, k) in place of h(n–k). Thus for a linear shift-invariant system
y(n) = x(k)h(n k)
k
Note that if the system is not specified to be shift-invariant we would leave the above
result in the form
y(n) = x(k)h(n, k)
k
or y(n) = x(k)hk (n)
k
The sum x(k)h(n, k) is called the convolution sum, and is denoted x(n) * h(n).
k
Theorem If a discrete-time system linear shift-invariant, T[.], has the unit sample response
T[δ(n)] = h(n) then the output y(n) corresponding to any input x(n) is given by
The second summation is obtained by setting m = n–k; then for k = – we have m = + , and for
k = we have m = – . Thus
33 of 77
Example 1.4.17 [Linear Convolution] Given the input {x(n)} ={1, 2, 3, 1} and the unit sample
response {h(n)} = {4, 3, 2, 1} find the response y(n) = x(n) * h(n).
Answer Since x(k) = 0 for k < 0 and h(n – k) = 0 for k > n, the convolution sum becomes
n
Now y(n) can be evaluated for various values of n; for example, setting n = 0 gives y(0). See
table below. The product terms shown in bold italics need not be calculated; they are zero
because the signal values involved are zero.
34 of 77
Sketches of the two sequences x(n) and h(n) are shown below.
x(n)
x(n) = 0, n < 0 & > 3
3
2
1
1
n
0 1 2 3
h(n)
h(n) = 0, n < 0 & > 3
4
3
2
1
n
0 1 2 3
To do the convolution we need the sequences x(k) and h(n–k), k being the independent
variable. Of these x(k) is simply x(n) with k replacing n, shown below.
x(k)
x(k) = 0, k < 0
3
2
1 1
k
0 1 2 3
h(n–k) = h(–(k–n))
4 h(n–k) = 0, k > n
3
----
k
n–1 n
The sequence h(–k) is the reflected version of h(k). If h(–k) is delayed by n samples we get h(–
(k–n)) that is h(n–k), shown above.
For each value of n the sequences x(k) and h(n–k) are multiplied point by point and the
products are added, yielding the value of y (.) for the corresponding n.
35 of 77
Tabular method The following tabular method uses the second of the two forms, viz., y(n) =
The sequence y(n) is shown plotted below. Note that Ly, the length of y(n), equals the sum of the
lengths of x(n) and h(n) minus 1: Ly = Lx + Lh – 1.
22
y(n) 18
n
–1 0 1 2 3 4 5 6 7 8
36 of 77
MATLAB (Linear Convolution)
20
18
16
14
12
10
0
0 1 2 3 4 5 6
37 of 77
Matrix-vector multiplication [Proakis, Study Guide, p. 12] When the sequences x(n) and h(n)
are of finite duration (as in this case) their linear convolution can also be implemented by using
matrix-vector multiplication. We show below the formulation using the form
as in the tabular method above. We arrange h(.) and y(.) as vectors (the latter with a length Ly =
Lx + Lh – 1) and the (Toeplitz) matrix X (of size Ly rows and Lh columns) formed from the
various shifted versions, x(n–k):
y(0) 1 0 0 0
4
y(1) 2
3
1 0 0
3 y(2) 2 1 0
h(.) = , y(.) = y(3) and X(.,.) = 1 3 2 1
2
y(4) 0 1 3 2
1
y(5) 0 0 1 3
y(6) 0 0 0 1
Note that the Toeplitz matrix may be seen (except for the zeros) in the center part of the table
given under “Tabular method”. →e then evaluate y as the product X . h:
y(0) 1 0 0 0
y(1) 32 1 0 0 4
y(2) 2 1 0 3
y(3) = 1 3 2 1 .
y(4) 0 1 3 2 2
1
y(5) 0 0 1 3
y(6) 0 0 0 1
MATLAB has a function called toeplitz that generates the Toeplitz matrix. We could, of course,
use the alternative form x(k) h(n k) in which case we evaluate y = H . x.
38 of 77
Example 1.4.18 [Linear Convolution] Given the finite length sequences below find y(n) =
x1(n)*x2(n).
x1(n) = 1, 0 ≤ n ≤ 3,
0, otherwise
x2(n) = 1, 0≤n≤3
0, otherwise
%Define sequences
n = 0:3; x1 = ones(size(n)), x2 = ones(size(n)),
%Length of output
M = length(x1) + length(x2) - 1; m = 0: M-1;
yn = conv(x1,x2); stem(m,yn)
xlabel('n'), ylabel('y(n)'), title('Convolution y(n) = x1(n) * x2(n)');
3.5
2.5
y(n)
1.5
0.5
0
0 1 2 3 4 5 6
n
39 of 77
Example 1.4.19 Given x1(n) = n {u(n+10) – u(n – 20)} and x2(n) = cos (0.1n) {u(n) – u(n –
30)}, find y(n) = x1(n) * x2(n).
Solution The intervals over which the sequences are non-zero are defined below:
For (the summation limits) N4 and N5 see DSP-HW. The MATLAB segment and plot are given
below:
60
40
20
y(n)
-20
-40
-60
-80
-10 0 10 20 30 40 50
n
40 of 77
Causality
The constraints of linearity and time-invariance define a class of systems that is represented by
the convolution sum. The additional constraints of stability and causality define a more restricted
class of linear time-invariant systems of practical importance.
Definition A discrete-time system is causal if the output at n = n0 depends only on the input for
n ≤ n0 .
The word “causal” has to do with cause and effect; in other words, for the system to act
up there must be an actual cause. A causal system does not anticipate future values of the input
but only responds to actual, present, input. As a result, if two inputs to a causal system are
identical up to some point in time n0 the corresponding outputs must also be equal up to this
same time. The synonyms of “causal” are “(physically) realizable” and “non-anticipatory”.
We digress below to introduce memory-less versus dynamic systems and then resume
with causality.
(Aside) Systems with and without memory A system is said to be memory-less or static if its
output for each value of n is dependent only on the input at that same time but not on past or
future inputs.
Examples of static systems
Getting back to causality, all memory-less systems are causal since the output responds
only to the current value of the input. In addition, some dynamic systems (such as the three listed
above) are also causal.
An example of a noncausal system is y(n) = x(n) + x(n+1) since the output depends on a
future value, x(n+1).
Although causal systems are of great importance, they are not the only systems that are of
practical importance. For example, causality is not often an essential constraint in applications in
which the independent variable is not time, such as in image processing. Moreover, in processing
data that have been recorded previously (non real-time), as often happens with speech,
geophysical, or meteorological signals, to name a few, we are by no means constrained to causal
41 of 77
processing. As another example, in many applications, including historical stock market analysis
and demographic studies, we may be interested in determining a slowly varying trend in data that
also contain higher frequency fluctuations about that trend. In this case, a commonly used
approach is to average data over an interval in order to smooth out the fluctuations and keep only
the trend. An example of such a Mnoncausal averaging system is
1
y(n) = 2M 1 x(k )
k M
Definition A discrete-time sequence x(n) is called causal if it has zero values for n < 0, i.e., x(n)
= 0 for n < 0.
Theorem A linear shift-invariant system with impulse response h(n) is causal if and only if h(n)
is zero for n < 0.
=0
n
= x(k) h(n k)
k
Thus y(n) at any time n is a weighted sum of the values of the input x(k) for k ≤ n, that is, only
the present and past inputs. Therefore, the system is causal.
Proof of the “Only If” part This is proved by contradiction, that is, if h(n) is non zero for n < 0
then the system is noncausal. Let h(n) be nonzero for n < 0:
h(n) is non zero for n < 0 h(n–k) is non zero for n–k < 0 or k > n
Example 1.4.21 Check the system y(n) = x(n) cos (n+1) for causality.
Answer Note that x(.) is the input, not the cos (.). In this system, the output at any time n equals
the input at that same time multiplied by a number that varies with time. We can write the
equation as y(n) = g(n) x(n), where g(n) = cos (n+1) is a time-varying function. Only the current
42 of 77
value of the input x(.) determines the current output y(.). Therefore the system is causal (and also
memoryless).
Example 1.4.22 Check the system y(n) = T[x(n)] = ne x(n) for causality. Answer Causal.
Example 1.4.23 Check the system y(n) = T[x(n)] = an cos (2πn/N) for causality. Answer Causal.
Example 1.4.24 Check the system y(n) = T[x(n)] = cos (x(n)) for causality. Answer Causal.
Example 1.4.25 Check the system y(n) = T[x(n)] = x(–n+2) for causality.
Answer For n ≤ 0 the argument of x, viz., –n+2 will be ≥ 2. For example, if n = 0 we have
Example 1.4.26 Check the system y(n) = T[x(n)] = x(k) for causality. Answer Causal.
k n0
n n0
Example 1.4.27 Check the system y(n) = T[x(n)] = x(k) for causality.
k n n0
n n0 n
Answer y(n) = x(k) = x(k ) + x(n+1) + x(n+2) + …+ x(n+n0)
k n n0
k n n0
Future terms
The system is noncausal since y(n) depends on future values of the input.
(Aside) A streamable system is one that is either causal or can be made causal by adding an
overall delay. The system y(n) = x(n+1) is not causal but can be made so and is therefore
streamable. But y(n) = x(–n) is not streamable since it can‟t be made causal.
As an example, the sequence x(n) = [1+cos 5πn] u(n) is bounded with |x(n)| ≤ 2. The
(1 n) sin10n
sequence x(n) = u(n) is unbounded.
1 (0.8)n
Definition A discrete-time system is bounded input-bounded output (BIBO) stable if every
bounded input sequence x(n) produces a bounded output sequence. That is, if |x(n)| M < , then
|y(n)| L < .
BIBO stability theorem A linear shift invariant system with impulse response h(n) is bounded
input-bounded output stable if and only if S, defined below, is finite.
43 of 77
S= h(k)
k
<
Proof of the “If” part Given a system with impulse response h(n), let x(n) be such that |x(n)|
M. Then the output y(n) is given by the convolution sum:
y(n) = h(k)x(n k)
k
so that
Using the triangular inequality that the sum of the magnitudes the magnitude of the sum, we
get
|y(n)| h(k)x(n k)
k
Using the fact that the magnitude of a product is the product of the magnitudes,
M h(k)
k
Thus, a sufficient condition for the system to be stable is that the unit sample response must be
absolutely summable; that is,
h(k)
k
QED
Proof of the “Only If” part That it is also a necessary condition can be seen by considering as
input, the following bounded signal (this is the signum function),
Or, equivalently,
1 where h(k) > 0
x(n–k) = sgn [h(k)] = 0 where h(k) = 0
–1 where h(k) < 0
In the above we have implied that M = 1 (since M is some arbitrary finite number), and that |x(n)|
1. If, however, |x(n)| M where M is finite but not equal to 1 we then will multiply the signum
function by M. In either case x(n) is a bounded input. Thus
y(n) = h(k) x(n k) = h(k) sgn[h(k)] = h(k)
k k k
44 of 77
h(k)
k 0
Example 1.4.28 Evaluate the stability of the linear shift-invariant system with the unit sample
response h(n) = an u(n).
Answer Evaluate
h(k) = a u(k) = a a
k k k
S= =
k k k0 k0
Here we have used the fact that the magnitude of a product (|ak|) is the product of the magnitudes
(|a|k). The summation on the right converges if |a| < 1 so that S is finite,
1
S=
1a
and the system is BIBO stable.
Example 1.4.29 Evaluate the stability of the system y(n) = T[x(n)] = n x(n).
Answer (Note that this is not a shift-invariant system, though it is linear as we determined
elsewhere. The BIBO stability theorem applies to LSI systems. Note that if x(n) = δ(n) we get the
result y(n) = h(n) = 0, for all n!)
If a system is suspected to be unstable, a useful strategy to verify this is to look for a
specific bounded input that leads to an unbounded output. One such bounded input is x(n) =
u(n), the unit step sequence. The output then is y(n) = n u(n), and as n ∞, y(n) grows without
bound. Hence the system is BIBO unstable.
h(n) = e, n=0
1, n 0
Here we are unable to find a bounded input that results in an unbounded output. So we
proceed to verify that all bounded inputs result in bounded outputs. Let x(n) be an arbitrary
signal bounded by B an arbitrary positive number,
Then y(n) = ex(n) must satisfy the condition e–B < y(n) < eB. Or, the output is guaranteed to be
bounded by eB. Thus the system is BIBO stable.
Example 1.4.31 Check for stability the system y(n) = an cos (2πn/N)
Answer The output is independent of the input. The system is stable for |a| 1, otherwise it is
unstable.
Convolution - Properties
45 of 77
Property 1 The convolution operation is commutative, that is, x(n) * h(n) = h(n) * x(n).
A linear shift-invariant system with input x(n) and unit sample response h(n) will have
the same output as a linear shift-invariant system with input h(n) and unit sample response x(n).
Property 2 The convolution of h(n) with δ(n) is, by definition, equal to h(n).
That is, the convolution of any function with the δ function gives back the original
function. Stated another way: The identity sequence for the convolution operator is the unit
sample, or
Property 4 Associativity
(1) The following three LSI systems have identical unit sample response:
x(n) y(n)
h1(n)*h2(n)
(c)
h1(n)
h2(n)
46 of 77
(3) A combination of the above two is the series parallel combination:
h2(n)
x(n) y(n)
h1(n) +
h3(n)
x(n) y(n)
h1(n)*h2(n) + h1(n)*h3(n)
a
k 0
k y(n k) = br x(n r) ,
r 0
a0 0
If the system is causal, then we can rearrange the above equation to compute y(n)
iteratively from the present input x(n) and the past inputs x(n–1), x(n–2), …, x(n–M) and the past
outputs y(n–1), y(n–2), …, y(n–N):
N
a
y(n) = – k y(n k) +
k 1 0
(
a
If we think of the input as beginning at n = 0, then y(n) can be computed for all n 0 once y(–1),
y(–2), …, y(–N) are specified. This is an iterative solution.
(Aside) Some write the difference equation with the terms y(n–1) through y(n–N) on the right
hand side with positive (symbolic) coefficients and the coefficient of y(n) = 1, thus
If we need to use this form we shall use different symbols altogether as follows:
Continuing the process we have y(n) = an , n 0. This is also the unit sample response h(n) =
an u(n). It is not always possible to express y(n) as an analytical expression (closed form) as
above.
Note It is also possible to recast the above problem as a noncausal or negative-time system with
y(n) = 0 for n 0. In this case, solving for y(n–1), we have
y(n–1) = y(n) x(n)
1
a
This can be recast (by letting (n–1) = m etc.) as
y(n) = y(n 1) x(n 1), n < 0
1
a
The solution now is y(n) = – an , for n < 0, or the impulse response is h(n) = – an u(–n–1).
Note Unless stated otherwise we shall generally assume that the difference equation represents a
causal system.
Other techniques for solving difference equations Among other techniques is a method
paralleling the procedure for solving linear constant coefficient differential equations, which
involves finding and combining the particular and homogeneous solutions. Another method
uses the z-transform (paralleling the Laplace transform). The state variable approach provides
another formulation of the problem and solutions in the time as well as frequency domains.
“FIR”, “IIR”, “Recursive” and “Nonrecursive” In the first example above the impulse
response h(n) = an , n 0 lasts for all positive time and is of infinite duration. In the second
example (moving average) h(n) = {1/3, 1/3, 1/3} which is of finite duration.
Definition If the unit sample response of a linear shift invariant system is of infinite duration, the
system is said to be an infinite impulse response (IIR) system.
Definition If the unit sample response of a linear shift invariant system is of finite duration, the
system is said to be a finite impulse response (FIR) system.
a
k 0
k y(n k) = b x(n r)
r0
r
a0 y(n) = b x(n r) , or
r0
r
b
M
y(n) = r x(n
r)
r 0 a0
The above difference equation is identical to the convolution sum, and the (br/a0) terms can be
recognized as h(r), the value of the unit sample response at time r, i.e., we can set (br/a0) = hr =
h(r). So the impulse response, h(n), is given by
h(n) = (bn/a0), 0 n M
0, otherwise
Note: If the above difference equation were written so that a0 = 1, we have y(n) = b x(n r) .
r0
r
In this case the impulse response consists simply of the coefficients br of the x(n–r) terms.
Iterative solution with initial conditions The LTI discrete-time system can be characterized by
N M
a
k 0
k y(n k) = br x(n r) ,
r 0
a0 0, and n 0 (A)
Here N is the order of the difference equation. When written out in full the equation is
The equation can be divided through by a0 so that the coefficient of y(n) is 1 or, alternatively, we
could impose the equivalent condition that a0 = 1.
An alternative form of the above equation is sometimes given as
N M
ak y(n k) = br x(n r) ,
k 0 r 0
n 0 (A‟)
49 of 77
and evaluate y(n) for n = 1, 2, … in an iterative manner. →e need the initial conditions y(–1), y(–
2), …, y(–N). The initial conditions needed to solve for y(n) using Eq. (A‟) in a similar fashion
are y(0), y(1), …, y(N–1).
We may assume that the system described by Eq. (A) is in a condition of initial rest, that
is, if x(n) = 0 for n < 0, then y(n) = 0 for n < 0 as well. With initial rest the system (A) is LTI and
causal.
An equation of the form (A) or (B) is called a recursive equation since it specifies a
recursive procedure to determine the output y(n) in terms of the input and previous output values.
In the special case where N = 0, Eq. (B) reduces to
y(n) = ( , (C)
Here y(n) is an explicit function of the present and previous values of the input only. Eq. (C) is
called a non-recursive equation, since we do not recursively use previously computed values of
the output in order to calculate the present value of the output.
50 of 77
The solution is
51
, , , ...
y(n) = 2, 5 15
4 16 64
This procedure does not, in general, yield an analytical expression for y(n), that is, a
closed-form solution. But it is easily implemented on a digital computer.
Example 1.5.4 [MATLAB] [Zero initial conditions] In the context of MATLAB, we may use
filter(b, a, x) to generate the sequence y(n). In MATLAB the coefficients of y(.) and x(.) are
numbered slightly differently as below:
we note that the input is x(n) = 1/ 4n and the coefficients of y(.) and x(.) give us the a and b
vectors, respectively: a = [1, -1.5, 0.5] and b = [1]. The following segment generates the output
with initial conditions taken as zero.
51 of 77
Input Sequence
1
x(n)
0.5
0
0 5 10 15 20 25
n
Output Sequence
3
2
y(n)
0
0 5 10 15 20 25
n
Example 1.5.5 [MATLAB] [Non-zero initial conditions] Find the solution to the difference
equation
y(n) – (3 / 2) y(n–1) + (1/ 2) y(n–2) = 1/ 4 , n0
n
52 of 77
Input Sequence
1
x(n)
0.5
0
0 5 10 15 20 25
n
Output Sequence
2
1.5
y(n)
0.5
0
0 5 10 15 20 25
n
(Omit) Recursive realization of FIR system – a simple example The moving average of the
signal x(n) is given by
x(n) x(n 1) x(n 2) ... x(n M )
y(n) =
M 1
Since past values of y(.) are not used in computing y(n) this is a nonrecursive implementation of
the FIR filter. The impulse response is
n= 0 M
1 1 A total of
h(n) = , 1 1 , …,
, M+1 terms
M1 M 1 M1 M 1
which consists of (M+1) samples or coefficients. We recognize, by replacing n by (n–1) in the
above equation, that
x(n 1) x(n 2) ... x(n M ) x(n M 1)
y(n–1) = (1)
M 1
x(n M 1)
By adding and subtracting on the right hand side of the equation for y(n) we can
M 1
arrive at a recursive implementation of the moving average:
x(n) x(n 1) x(n 2) ... x(n M ) x(n M 1) x(n M 1)
y(n) =
M 1
Using eq. (1) we can write y(n) as
x(n) x(n M 1)
y(n) = y(n–1) +
M 1
which clearly is a recursive implementation since it involves y(n–1), a past value of y.
53 of 77
(End of Omit)
There is some variation on the form of this equation. As given here it has (M+1) coefficients and
M delay elements. Sometimes it is more convenient to use this with M coefficients rather than
(M+1). Either way its order is N = 0. Note that we have tied the order to the oldest term in y(.)
and not to the oldest term in x(.). See Aside below.
An autoregressive (AR) filter is one with its output dependent on the present input (but
not previous inputs) and previous outputs – this is a purely recursive system. In terms of the
above difference equation this corresponds to M = 0 and is of the form
More generally, an autoregressive moving average (ARMA) filter has its output depend
on the present input, M previous inputs, and N previous outputs. In terms of the linear constant
coefficient difference equation this has the form
H(z) =
b z
i0
i i
1 ai z i
i 1
This represents an IIR filter if at least one of a1 through aN is nonzero, and all the roots of the
denominator are not canceled exactly by the roots of the numerator. For example, in the system,
H(z) = (1 z8 ) (1 z1 ) , the single pole at z = 1 is canceled exactly by the zero at z = 1, making
H(z) a finite polynomial in z 1 , that is, an FIR filter.
In general, there are M finite zeros and N finite poles. There is no restriction that M
should be less than or greater than or equal to N. In most cases, especially digital filters derived
from analog designs, M will be less than or equal to N. Systems of this type are called Nth order
systems.
When M > N, the order of the system is no longer unambiguous. In this case, H(z) may be
taken to be an Nth order system in cascade with an FIR filter of order (M – N).
When N = 0, as in the case of an FIR filter, according to our convention the order is 0; it
is more useful in this case to focus on M and call it an FIR filter of M stages or (M+1)
coefficients.
(End of Aside)
54 of 77
Fourier analysis of discrete-time signals and systems
Note For the discrete-time Fourier transform some authors (Oppenheim & Schafer, for instance)
use the symbol X(ejω) while others (Proakis, for instance) use the symbol X(ω). The symbol ω is
used for digital frequency (radians per sample or just radians) and the symbol Ω for the analog
frequency (radians/sec). Some authors, on the other hand, use just the opposite of our
convention, that is, ω for the analog frequency (radians/sec) and Ω for the digital frequency
(radians).
Discrete-time Fourier transform (DTFT) For the continuous-time signal x(t), the Fourier
transform is
x(t) e
j t
F{x(t)} = X(Ω) = dt
xs(t) = x(t) (t nT )
n
= x(nT ) e
n
j nT
where the last step follows from the sifting property of the δ function. Replace ΩT by ω the
discrete-time frequency variable, that is, the digital frequency. Note that Ω has units of
radians/second, and ω has units of radians (/sample). This change of notation gives the discrete-
time Fourier transform, X(ω), of the discrete-time signal x(n), obtained by sampling x(t), as
Note that this defines the discrete-time Fourier transforms of any discrete-time signal x(n). The
transform exists if x(n) satisfies a relation of the type
x(n) x(n)
2
<∞ or <∞
n n
These conditions are sufficient to guarantee that the sequence has a discrete-time Fourier
transform. As in the case of continuous-time signals there are signals that neither are absolutely
summable nor have finite energy, but still have a discrete-time Fourier transform. (See also p. 22,
O & S.)
55 of 77
1
X (e ) e j nd
j
F-1{X(ω)} = x(n) = (B)
2
Equations (A) and (B) are called the Fourier transform pair for a sequence x(n) with X(ω)
thought of as the frequency content of the sequence x(n). Equation (A) is the analysis equation
and equation (B) is the synthesis equation. Since X(ω) is a periodic function of ω, we can think
of x(n) as the Fourier coefficients in the Fourier series representation of X(ω). That is, equation
(A), in fact, expresses X(ω) in the form of a Fourier series.
The sketch below sums up the relationship between the time and frequency domains. The
periodicity is 2π. From the relation ω = ΩT we can deduce that at the point ω = 2π on the
horizontal axis Ω = ω/T = 2π/T = 2πFs = Ωs. In other words, in terms of the analog frequency
variable the point ω = 2π corresponds to Ω = Ωs or F = Fs.
x(n) Non-periodic
n
0
X(ω)
Periodic, complex-valued
–2 – 2
(Omit) Relationship to the z-transform The z-transform X(z) and the Fourier transform X(ω) are
given by
X(z) = x(n) z n
and X(ω) = x(n) e j n
n n
X(ω) = x(n) e
j n
X (z) j
z e
n
The z-transform evaluation on the unit circle gives the Fourier transform of the sequence
x(n). The z-transform of x(n) can be viewed as the Fourier transform of the sequence {x(n) r–n},
that is, x(n) multiplied by an exponential sequence r–n. This can be seen by setting z = r ejω in the
defining equation of X(z):
x(n) r e x(n) r
j n
X(z) = = n
e j n
n n
z x(n) multiplied by the
exponential sequence r–n
56 of 77
Z-transform of a periodic sequence Consider a sequence x(n) that is periodic with period N so
that x(n) = x(n+kN) for any integer value of k. Such a sequence cannot be represented by its z-
transform, since there is no value of z for which the z-transform will converge.
(End of Omit)
Example 1.6.1 [Cf. Example 4.2.3, Proakis, 4th Ed.] For the exponential sequence x(n) = an u(n),
|a| < 1, the DTFT is
X (e j ) = a n e j n = ae j =
n 1 1
=
1 ae j 1 a(cos j sin )
n0 n0
We shall put this in the form X(ω)= Magnitude {X} e j Phase{X } = X () e jX ( ) from which the
magnitude and phase will be extracted. The denominator (Dr.) is
a sin
j tan1
Dr. = 1 a cos ja sin = (1 a cos ) a sin e
2 2 2 1a cos
Thus
1 a sin
X(ω) = |X(ω)| e jX ( ) = j tan1 1a cos
e
(1 a 2a cos )
2
X () = tan1 a sin 0 =0
0
1 a cos 0
Similarly, at ω = we have X ( ) = 1/(1 a) and X () = 0.
Phase angle of a complex number In calculating the phase angle of a complex number, z =
Re(z) + j Im(z), a hand held calculator, typically uses the formula tan 1 Im( z) / Re( z), and returns an
answer in the range –/2 < angle ≤ /2. Thus for both (1–j) and (–1+j) the phase angle so
calculated is /4. However, (1–j) is in the 4th quadrant with (1 j) = –/4 whereas (–1+j) is in
the 2nd quadrant with (1 j) = 3/4. MATLAB has a function angle which takes into account
the real and imaginary parts separately (instead of their ratio) and calculates the “four-quadrant
inverse tangent”.
Example 1.6.2 [MATLAB fplot] To illustrate the magnitude and phase plots of the DTFT we
take a = 0.8 in the exponential sequence x(n) = an u(n), |a| < 1, treated above. Thus x(n) =
(0.8)n u(n). We need only plot over the interval –π ≤ ω ≤ π or 0 ≤ ω ≤ 2π. To show, visually, the
periodicity we have plotted over –3π ≤ ω ≤ 3π. We have
X (e j ) = a n e j n = ae j =
n 1 1 j
=
1 ae j 1 0.8 e
n0 n0
57 of 77
In the MATLAB program segment that follows we write an algebraic expression for
1
X (e j )= as (1) / (1-0.8*exp(-j*w)). Note that we have used „w‟ for ω and the plot
1 0.8 e j
ranges from –2 to 2. Both ω and the phase, X ( ) , are in radians. The parameter 'k' means that
the plot/display is in black “color”.
1 1
X () 0 = = =5
1 a 1 0.8
X () = 1/(1 a) = 1/1.8 = 0.555
4
Magnitude
0
-8 -6 -4 -2 0 2 4 6 8
1
0.5
Phase
-0.5
-1
-8 -6 -4 -2 0 2 4 6 8
58 of 77
Example 1.6.3 [MATLAB freqz] We repeat the frequency response plots using the freqz
function. Taking a = 0.8 as before, we have x(n) = (0.8)n u(n) and
= ae j =
j n j n n 1
X (e ) = a e = 1 j
1 ae j 1 0.8 e
n0 n0
1
Instead of writing an algebraic expression for X (e j )= as in the previous example, we
1 0.8 e j
shall now specify the numerator and denominator in terms of their coefficients. We shall use the
following convention to specify the parameters of the function
j j 2
b(1) b(2)e b(3)e ... 1
X (e j ) = =
a(1) a (2)e j a(3)e j 2 ... 1 0.8 e j
Here the vectors b and a specify, respectively, the numerator and denominator coefficients. In
our example b(1) = 1, a(1) = 1, and a(2) = –0.8. The MATLAB segment and the corresponding
plots follow. Note that the plot goes from – to , not –3 to 3.
6
Magnitude of X()
0
-4 -3 -2 -1 0 1 2 3 4
Frequency
0.5
Phase of X()
-0.5
-1
-4 -3 -2 -1 0 1 2 3 4
Frequency
59 of 77
Example 1.6.4 Find the DTFT, X(ω), for x(n) = {1, 2, 3, 4, 3, 2, 1}.
Solution The DTFT is
6
X (e j
) = x(n) e j n = 1+ 2e j1 + 3e j 2 + 4e j3 + 3e j 4 + 2e j5 +1e j 6
n 0
%Sketch of sequence
n = 0:1:6; xn = [1, 2, 3, 4, 3, 2, 1];
subplot (3, 1, 1), stem(n, xn)
xlabel('n'), ylabel('x(n)'); grid
%Frequency response
b = [1, 2, 3, 4, 3, 2, 1]; %Numerator coefficients
a = [1]; %Denominator coefficients
w = -pi: pi/256: pi; %A total of 512 points
[Xw] = freqz(b, a, w);
subplot(3, 1, 2), plot(w, abs(Xw));
xlabel('Frequency \omega'), ylabel('Magnitude of X(\omega)'); grid
subplot(3, 1, 3), plot(w, angle(Xw));
xlabel('Frequency \omega'), ylabel('Phase of X(\omega)'); grid
4
x(n)
0
0 1 2 3 4 5 6
n
Magnitude of X()
20
10
0
-4 -3 -2 -1 0 1 2 3 4
Frequency
5
Phase of X()
-5
-4 -3 -2 -1 0 1 2 3 4
Frequency
Example 1.6.5 Find the DTFT, X(ω), for
(a) x(n) = {1, 2, 3, 4, 3, 2, 1, 0}
(b) x(n) = {1, 2, 3, 4, 3, 2, 1, 0, …, 0}
Solution !?!
60 of 77
The following examples are repeated in Unit II – DFS &DFT.
Example 1.6.6 Obtain the 7-point DFT of the sequence x(n) = {1, 2, 3, 4, 3, 2, 1} by taking 7
samples of its DTFT uniformly spaced over the interval 0 ≤ ω ≤ 2π.
Solution The sampling interval in the frequency domain is 2π/7. From Example 4 we have
X (e j ) or X(ω) = 1+ 2e j1 + 3e j 2 + 4e j3 + 3e j 4 + 2e j5 +1e j 6
= (2 cos 3 +4 cos 2 +6 cos +4) e j3
The DFT, X (k) , is given by replacing ω with k(2π/7) where k is an index ranging from 0 to 6:
DFT = X () = X (2k / 7) , k = 0 to 6
2 k / 7
MATLAB:
w = 0: 2*pi/7: 2*pi-0.001
XkfromDTFT = (4+6*cos(w)+4*cos(2*w)+2*cos(3*w)) .* exp(-j*3*w)
MATLAB solution:
This is the 7-point DFT obtained by sampling the DTFT at 7 points uniformly spaced in (0, 2π).
It should be the same as the DFT directly obtained, for instance, by using the fft function in
MATLAB:
MATLAB:
xn = [1 2 3 4 3 2 1]
Xkusingfft = fft(xn)
MATLAB solution:
Example 1.6.7 Obtain the 7-point inverse DTFT x(n) by finding the 7-point inverse DFT of X(k):
MATLAB:
MATLAB solution:
61 of 77
This is the original sequence we started with in Example 4.
Example 1.6.8 What will be the resulting time sequence if the DTFT of the 7-point sequence is
sampled at 6 (or fewer) uniformly spaced points in (0, 2π) and its inverse DFT is obtained?
Solution The sampling interval in the frequency domain now is 2π/6. From Example 4 we have
X (e j ) or X(ω) = 1+ 2e j1 + 3e j 2 + 4e j3 + 3e j 4 + 2e j5 +1e j 6
= (2 cos 3 +4 cos 2 +6 cos +4) e j3
The DFT then is given by
MATLAB:
w = 0: 2*pi/6: 2*pi-0.001
Xk6point = (4+6*cos(w)+4*cos(2*w)+2*cos(3*w)) .* exp(-j*3*w)
MATLAB solution:
Xk6point = [16, (-3.0000 - 0.0000i), (1.0000 + 0.0000i), 0, (1.0000 + 0.0000i),
(-3.0000 - 0.0000i)]
This is the 6-point DFT obtained by sampling the DTFT at 6 points uniformly spaced in (0, 2π).
Example 1.6.9 Obtain the 6-point inverse DTFT x(n) by finding the 6-point inverse DFT of
Xk6point:
MATLAB:
MATLAB solution:
xn = [2 2 3 4 3 2]
62 of 77
Example 1.6.10 What will be the resulting time sequence if the DTFT of the 7-point sequence is
sampled at 8 (or more) uniformly spaced points in (0, 2π) and its inverse DFT is obtained?
Solution The sampling interval in the frequency domain now is 2π/8. From Example 4 we have
X (e j ) or X(ω) = 1+ 2e j1 + 3e j 2 + 4e j3 + 3e j 4 + 2e j5 +1e j 6
= (2 cos 3 +4 cos 2 +6 cos +4) e j3
The DFT then is given by
MATLAB:
w = 0: 2*pi/8: 2*pi-0.001
Xk8point = (4+6*cos(w)+4*cos(2*w)+2*cos(3*w)) .* exp(-j*3*w)
MATLAB solution:
This is the 8-point DFT obtained by sampling the DTFT at 8 points uniformly spaced in (0, 2π).
Example 1.6.11 Obtain the 8-point inverse DTFT x(n) by finding the 8-point inverse DFT of
Xk8point:
MATLAB:
MATLAB solution:
xn = [1 2 3 4 3 2 1 0]
We see that the original 7-point sequence has been preserved with an appended zero. The
original sequence and the zero-padded sequence (with any number of zeros) have the same
DTFT. This is a case of over-sampling the continuous-ω function X(ω): there is no time-domain
aliasing. This is similar to the situation that occurs when a continuous-time function x(t) is over-
sampled: the corresponding frequency domain function Xs () is free from frequency-domain
aliasing.
%Sketch of sequences
n = 0:1:6; xn = [1, 2, 3, 4, 3, 2, 1];
63 of 77
subplot (3, 1, 1), stem(n, xn)
xlabel('n'), ylabel('x(n)-7point'); grid
%
n = 0:1:5; xn = [2 2 3 4 3 2];
subplot (3, 1, 2), stem(n, xn)
xlabel('n'), ylabel('x(n)-6point'); grid
%
n = 0:1:7; xn = [1, 2, 3, 4, 3, 2, 1, 0];
subplot (3, 1, 3), stem(n, xn)
xlabel('n'), ylabel('x(n)-8point'); grid
4
x(n)-7point
0
0 1 2 3 4 5 6
n
4
x(n)-6point
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
n
4
x(n)-8point
0
0 1 2 3 4 5 6 7
n
H(ω)
= H(ω) e j n
Thus we see that H(ω) describes the change in complex amplitude of a complex exponential as a
function of frequency. The quantity H(ω) is called the frequency response of the system. In
64 of 77
general, H(ω) is complex valued and may be expressed either in the Cartesian form or the polar
from as
H(ω) = HR(ω) + j HI (ω) or H(ω) = Ĥ ( ) e jH ( )
where HR and HI are the real part and imaginary part respectively. Ĥ ( ) is loosely called the
magnitude and H ( ) is loosely called the phase. Strictly speaking, Ĥ ( ) is called the zero-
phase frequency response; note that Ĥ ( ) is real valued but may be positive or negative. We
may use the symbol |H(ω)| for the magnitude which is strictly non-negative. If Ĥ ( ) is positive
then
Magnitude = H ( ) = Ĥ ( ) & Phase = H()
If Ĥ ( ) is negative then
Magnitude = H ( ) = Ĥ ( ) = – Ĥ ( ) & Phase = H ( ) ± π
We shall often loosely use the symbol H ( ) to refer to Ĥ ( ) as well with the understanding
that when the latter is negative we shall take its absolute value (the magnitude) and accordingly
adjust H ( ) by ± π.
Example 1.7.1 [Moving average filter] The impulse response of the LTI system
x(n) x(n 1) x(n 2)
y(n) =
3
is
h(n) = 1/3, n = 0, 1, 2
0, otherwise
1/3
n
0 1 2 3
= (1/ 3) e j k = 1 e j 0 e j 1 e j 2
2
H(ω) = h(k) e j k
3
k k 0
= e j
e j
1 e j
= = e
3 3 2 3
which is already in the polar form H () = ± H () e jH ( ) , so that
H () = (1 2 cos ) / 3 and H () = –ω
The zero crossings of the magnitude plot occur where H () = (1 2 cos ) / 3 = 0, or ω
= cos1 (1/ 2) = 2π/3 = 1200. A frequency of ω = 2π/3 rad./sample (f = 1/3 cycle/sample) is
totally stopped (filtered out) by the filter. The corresponding digital signal is x5(n) = cos
2π(1/3)n. The underlying continuous-time signal, x5(t), depends on the sampling frequency. If,
65 of 77
for example, the sampling frequency is 16Hz, then x5(t) = cos 2π(16/3)t, and a frequency of 16/3
Hz will be totally filtered out. If the sampling frequency is 150Hz, then x5(t) = cos 2π(150/3)t,
and a frequency of 50 Hz will be eliminated.
In calibrating the horizontal axis in terms of the cyclic frequency, F, we use the relation
ω = ΩT = 2πFT = 2πF/Fs from which the point ω = 2π corresponds to F = Fs.
–2π –π 0 π 2π
H (ω) = –ω
ω
–2π –π 0 π 2π
(Aside) The system y(n) = x(n) + x(n 1) + x(n 2) is a crude low pass filter, but the
3 3 3
attenuation does not increase monotonically with frequency. In fact, the highest possible
frequency, Fs/2 Hz, (or π rad/sample) is not well attenuated at all. The following is a slight
variation of the three-term moving average:
y(n) = x(n) + x(n 1) + x(n 2)
4 2 4
Its magnitude response is a “raised cosine” (with no zero crossing, monotonically decreasing but
wider than the 3-term).
(End of Aside)
66 of 77
Example 1.7.2 [MATLAB fplot] [Moving average filter]
H(ω) = 1 1 e j 1 e j 2 .
3
The program follows. Note that in MATLAB we use „w‟ for ω and the plot ranges over
(–2, 2). Both ω and the phase, X ( ) , are in radians.
1
Magnitude
0.5
0
-6 -4 -2 0 2 4 6
4
2
Phase
-2
-4
-6 -4 -2 0 2 4 6
Example 1.7.3 [MATLAB filter, freqz] [Moving average filter] Consider a signal x(t) = cos
(250t) sampled at 150 Hz. The corresponding x(n) = cos (2n/3) is the input to the moving
average filter. The following MATLAB segment plots x(n) vs. n and y(n) vs. n.
n=0:1:50;
x=cos(2*pi*n/3);
b=[1/3, 1/3, 1/3]; a=[1]; %Filter coefficients
y=filter(b, a, x);
subplot(3, 1, 1), stem(n, x, 'ko');title('Input x(n)=Cosine(2\pin/3)');
67 of 77
xlabel('n'), ylabel('x(n)')
subplot(3, 1, 2), stem(n, y, 'ko');title('Output y(n)=[x(n)+x(n-1)+x(n-2)]/3');
xlabel('n'), ylabel('y(n)');
w=0: pi/256: 2*pi; h=freqz(b, a, w);
subplot(3, 1, 3), plot(w*75/pi, abs(h));title('Magnitude Response');
xlabel('Frequency'), ylabel('Magnitude');
Input x(n)=Cosine(2n/3)
1
x(n)
-1
0 5 10 15 20 25 30 35 40 45 50
n
Output y(n)=[x(n)+x(n-1)+x(n-2)]/3
0.5
y(n)
-0.5
0 5 10 15 20 25 30 35 40 45 50
n
Magnitude Response
1
Magnitude
0.5
0
0 50 100 150
Frequency
Example 1.7.4 [MATLAB filter] [Moving average filter] As an extension of above example,
consider the signal consisting of a 2 Hz desirable component plus a noise component of 50 Hz
(with a smaller amplitude), sampled at 150 Hz.
x(t) = 5 cos (22t) + 2 cos (250t)
x(n) = 5 cos (2n/75) + 2 cos (2n/3)
In the following MATLAB segment we show both sequences, x(n) and y(n), on the same
(multi)plot so that they have the same scale. The smoothing action of the filter is easily
discernible in the multiplot.
n = 0: 1: 50;
x = 5*cos(2*pi*n/75) + 2*cos(2*pi*n/3);
b = [1/3, 1/3, 1/3]; a = [1]; %Filter coefficients
y = filter(b, a, x);
plot(n, x, 'b*', n, y, 'ko');
legend ('Input x(n)', 'Output y(n)');
title ('Moving average filter');
xlabel ('n'), ylabel('x(n), y(n)');
68 of 77
Moving average filter
8
Input x(n)
Output y(n)
6
2
x(n), y(n)
-2
-4
-6
0 5 10 15 20 25 30 35 40 45 50
n
2
x(n), y(n)
-2
-4
-6
0 50 100 150
n
69 of 77
[Homework] Examples 5.1.1, 5.1.2, 5.1.3 and 5.1.4, Proakis, 4th Ed.
Sketches of ideal digital low pass and high pass filters Ref. p. 23, O&S for LP filter.
Example 1.7.5 [2003] [O & S, p. 20, and L.C. Ludeman, p. 51] A linear time-invariant system
has unit sample response h(n) = u(n) – u(n–N). Find the amplitude and phase spectra.
Note that this would be an N-term moving average filter if h(n) =(1/N)[ u(n) – u(n–N)].
n
0 1 2 N–1 N
N terms
h(n) = 1, 0 n N–1
0, elsewhere
N 1 j N
h(k) e 1e
j k j k 1 e
H(ω) = = =
k k 0 1 e j
Example 1.7.6 [MATLAB fplot] [5-term moving average filter] The program for the case
where N = 5 follows.
1 e j 5
H(ω) = 1 e j 1 e j 2 e j3 e j 4 =
1 e j
Note that in MATLAB we use „w‟ for ω and the plot ranges from –2 to 2. Both ω and the
phase, X ( ) , are in radians.
70 of 77
6
4
Magnitude
0
-6 -4 -2 0 2 4 6
(Rad)
4
2
Phase (Rad)
-2
-4
-6 -4 -2 0 2 4 6
(Rad)
For the DTFT Oppenheim & Schafer use the symbol X (e j ) while Proakis uses X(ω).
(1) Periodicity X(ω) is periodic with period 2π, that is, X(ω+2π) = X(ω) for all ω. Since e j n is
periodic in ω with period 2π, it follows that X(ω) is also periodic with the same period.
Replacing ω with (ω+2π) gives
X(ω+2π) = x(n) e
n
j ( 2 ) n
= x(n) e
n
j n j 2 n
e = x(n) e
n
j n
1
(2) Linearity The discrete Fourier-transform is a linear operation. If F{x1(n)} = X1(ω) and
F{x2(n)} = X2(ω), then F{a1 x1(n) + a2 x2(n)} = a1 X1(ω)+ a2 X2(ω) for any constants a1 and a2.
(3) Time shifting Time shift results in phase shift. If F{x(n)} = X(ω), then F{x(n–k)} =
e j k X(ω).
Proof We have
F{x(n–k)} = x(n k) e
n
j n
On the right hand side set n–k = m, so that n = m+k and the limits n = – to change to m = –
to + . Then
71 of 77
F e j0 n
e
x(n) = j0 n
x(n) e j n
= x(n) e j ( 0 ) n
= X(ω–ω0) QED
n n
d
1 j n
F-1{X(ω–ω0)} =
2 2
X ( 0 ) e
Set ω–ω0 = λ so that ω = λ+ω0 and the limits ω = 0 to 2π change to λ = –ω0 to (–ω0+2π), which
amounts to any interval of length 2π. Also dω= dλ. Then
d
1 j ( 0 ) n
F-1{X(ω–ω0)} =
2 2
X ( ) e
1
X ( ) e d = e
j n j n
= e j0 n
0
x(n) QED
2 2
(5) Time reversal corresponds to frequency reversal. Given F{x(n)} = X(ω), then F{x(–n)} =
X(–ω).
Proof We have
F{x(–n)} = x(n) e
n
j n
On the right hand side set m = –n so that the limits n = – to change to m = to – , and
F{x(–n)} = x(m) e j m
m
Since this is a summation the limits can be written in reverse order, and we have
F{x(–n)} = x(m) e
m
j ( ) m
= X(–ω) = X (e j ) QED
dX (e j )
(6) Differentiation in frequency F{n x(n)} = j . Since
d
j
X (e ) = x(n) e j n
n
= h(k)x(n k) e
j n
n k
Interchanging the order of summation
Y (e )= h(k) x(n k) e
j j n
k n
The inner sum (I.S.) is handled thus: Let (n–k) = λ. Then as n goes from – to , λ goes from –
to as well. Further n = λ+k. Thus the inner sum becomes
I.S. = x(n k) e j n
=
x() e j ( k ) = x() e j e j k = e–jωk X (e j )
n
Thus we have
(8) Multiplication of two sequences Let y(n) be the product of two sequences x1(n) and x2(n)
with transforms X1 (e j ) and X 2 (e j) , respectively. Then
1
=2 X
j
X e j ( )
d
e 1 2
2
This is called periodic convolution since both X1 (e j) and X 2 (e j) are periodic functions.
(9) Parseval’s Theorem If x(n) and X (e j ) are a Fourier transform pair, then
x(n) = X e d
2 1 j 2
n 2 2
Proof The energy E of the discrete-time sequence is defined as
n n
1
Making the substitution x*(n) =
X * e j e j n d , we get
2
E = x(n) 1 X * e j e j n d
n 2
Interchanging the order of integration and summation,
73 of 77
E=
1
X e x(n) e
* j j n
d = 1 X * e j X e j d
2 n 2
= X (e j )
X e
2
=
1 j
d QED
2
This is time expansion. For example, if k =3, then y(n) is obtained from x(n) by placing k–1 = 2
zeros between successive values of x(n). That is,
Since y(n) equals zero unless n is a multiple of k, i.e., unless n = rk, where r = all integers from
– to + , we have the Fourier transform of y(n) as:
= y(n) e
Y e j j n
= y(rk) e j r k
n r
= x(r) e
Y e j j r k
= x(r) e j (k ) r
= X e jk
r r
where x(n) is the input and y(n) is the output. Determine its magnitude and phase response as a
function of frequency.
Solution The frequency response is obtained by taking the discrete-time Fourier transform of
both sides of the difference equation:
74 of 77
Y (e j )– 5 e–jω Y (e j )= X (e j ) + 4 e–jω X (e j )
Y (e j ) (1 – 5 e–jω) = X (e j ) (1 + 4 e–jω)
1 4sin
j j tan
Y (e j ) = H (e j ) = 1 4e = (1 4 cos ) 2 (4 sin ) 2 e 14cos
X (e j ) 1 5e j
5sin
j tan1
(1 5 cos ) (5sin ) e
2 2 15cos
4sin
j tan1 tan1 5sin
(1 4 cos ) (4 sin )
2 2
14cos 15cos
= e
(1 5 cos )2 (5sin )2
With the notation H () = H () e jH ( ) we can identify the magnitude and phase, respectively,
as follows:
(1 4 cos ) 2 (4 sin ) 2 17 8 cos
|H(ω)| = =
(1 5 cos ) (5sin )
2 2
26 10 cos
4 sin 5sin
H (e j )= tan1 tan1
1 4 cos 1 5 cos
1 4e j
The MATLAB program follows for H(ω) = . Note that in MATLAB we use „w‟
1 5e j
for ω and the plot ranges from –2 to 2. Both ω and the phase, X ( ) , are in radians.
1.5
Magnitude
0.5
-6 -4 -2 0 2 4 6
Omega
0.1
0.05
Phase
-0.05
-0.1
-6 -4 -2 0 2 4 6
Omega
75 of 77
Example 1.8.2 [Convolution] If X (e j ) = DTFT{x(n)} and y(n) = x(n)*x(–n) then from
Properties 5 and 7 Y (e j )= DTFT{y(n)} = DTFT{x(n)*x(–n)}= X (e j ) X (e j ) . This result
may also be obtained from the defining equation
Y (e )= {x(n)* x(n)}e j n
j
n
n k
Example 1.8.3 [2009] [Convolution] If X (e j ) = DTFT{x(n)} and y(n) = x(n) x (n) find
Y (e j )= DTFT{y(n)}.
Example 1.8.4 [2008] Find a difference equation to implement a filter with unit sample response
h(n) = 1/ 4n cos(n / 3) u(n)
Solution In the math manipulation it would help to write cos(n / 3) in its exponential form. You
should also memorize the two standard z-transform pairs: Z{ cos(0n) u(n)} and
Z{ an cos(0 n) u(n) }.
Hint Either use DTFT: Find the DTFT F{h(n)} = H(ejω) = Nr() .
Dr()
Y (e j ) jω
j
X (e j ) = a n e j n = ae j =
n 1
with a = 1/3
1 ae j
n0 n0
76 of 77
Then use the scaling property that if x(n) X e j , then x(n/k)
X e jk with k = 10.
Alternatively, use the defining equation
1
F-1{X(ω)} = x(n) = X (e j ) e j nd
2
Example 1.8.6 [Scaling – compression in time] Given x(n) X e j and y(n) = x(2n), find
Y e j .
Solution This is a specific result, not a general property. We have
Y e j = y(n) e j n = x(2n) e j n
n n
= x(n) e
n even
jn/2
x(n) e x(n) e
1 j ( / 2) n 1 j ( / 2) n
= +
2 n 2 n
Notationally, we may write this as
Y e j = X e j / 2 + X e j / 2
1 1
2 2
77 of 77
Digital Signal Processing – 1(B)
Contents:
Introduction
Important properties of z-transforms
Transforms of some useful sequences
Region of convergence and stability
Inverse z-transform by partial fractions
Relationships among system representations
Inverse z-transform by power series expansion (long division)
Computation of frequency response
Z-transforms with initial conditions
Steady-state and transient responses for a first order system
Realization of digital filters
The Lattice structure – Introduction
*Inverse z-transform by complex inversion integral
Introduction
For continuous-time systems the Laplace transform is an extension of the Fourier transform.
The Laplace transform can be applied to a broader class of signals than the Fourier transform
can, since there are many signals for which the Fourier transform does not converge but the
Laplace transform does. The Laplace transform allows us, for example, to perform transform
analysis of unstable systems and to develop additional insights and tools for LTI system analysis.
The z-transform is the discrete-time counterpart of the Laplace transform. The z-
transform enables us to analyze certain discrete-time signals that do not have a discrete-time
Fourier transform. The motivations and properties of the z-transform closely resemble those of
the Laplace transform. However, as with the relationship of the continuous time versus the
discrete-time Fourier transforms, there are distinctions between the Laplace transform and the z-
transform.
Definition The two-sided (bilateral) z-transform, X(z), of the sequence x(n) is defined as
X+(z) = x(n)z n
n 0
The unilateral z-transform is particularly useful in analyzing causal systems specified by linear
constant-coefficient difference equations with nonzero initial conditions into which inputs are
stepped. It is extensively used in digital control systems.
Im
z-plane
ROC
Re
Rx+
Rx–
The region of convergence (ROC) is the set of z values for which the above summation
converges. In general the ROC is an annular region in the complex z-plane given by
Relationship between the z-transform and the discrete-time Fourier transform Setting z =
r e j in the definition gives us
X (z) j = x(n)re
j n
= [r x(n)]e
n j n
x(t) = e t , t 0
0, otherwise
t nT
x(n) = an , n 0
0, n<0
If a < 1 this sequence decays exponentially to 0 as n → ∞. Substituting x(n) into the defining
equation, the z-transform is
1 z
= = , |z| > |a|
1 az 1
z a
Re
a
Zero at 0
The ROC is |z| > |a|. This X(z) is a rational function (a ratio of polynomials in z). The
roots of the numerator polynomial are the zeros of X(z) and the roots of the denominator
polynomial are the poles of X(z).
This is a right-sided sequence. Right-sided sequences have a ROC that is the exterior of a
circle with radius Rx– (|z| > |a| in this case). If the ROC is the exterior of a circle it is a right-
sided sequence.
Definition A right-sided sequence x(n) is one for which x(n) = 0 for all n < n0 where n0 is
positive or negative but finite. If n0 0 then x(n) is a causal or positive-time sequence.
Example 1.1.2 The negative-time sequence x(n) = –bn u(–n–1). Recall that the unit step
sequence u(.) = 1 if the argument of u(.) is 0, i.e., if (–n–1) 0 or n –1.
x(n) = –bn, n –1
0, otherwise
X(z) = – (bz ) = 1– b 1 z
1 m m
m m0
We added 1 in the last step above to make up for the m = 0 term within the summation. The
result is,
1
X(z) = 1– 1
, |z b–1| < 1
(1 zb )
z
= , ROC is |z| < |b|
zb
Im
z-plane
pole
ROC
Re
b
zero
This is a left-sided sequence. Such a sequence has a region of convergence which is the
interior of a circle, |z| < Rx+. In this case the ROC is |z| < |b|.
Note that if b = a then the two examples above have exactly the same X(z). So what
makes the difference? The region of convergence makes the difference.
Definition A left-sided sequence x(n) is one for which x(n) = 0 for all n n0, where n0 is
positive or negative but finite. If n0 0 then x(n) is an anticausal or negative-time sequence.
Example 1.1.3 [Two-sided sequence] This is the sum of the positive- and negative-time
sequences of the previous two examples.
z (ROC |z| > |a|) & z (ROC |z| < |b|)
a z
n n
b n z n
n0 z a n zb
So, the desired transform Y(z) has a region of convergence equal to the intersection of the two
separate ROC’s |z| > |a| and |z| < |b|. Thus
z
Y(z) = z , with ROC {|z| > |a|} {|z| < |b|}
z a z b
z(2z a b)
= , with ROC |a| < |z| < |b|
(z a)(z b)
The ROC is the overlap of the shaded regions, that is, the annular region between |a| and |b|. The
two zeros are at 0 and (a+b)/2, and the two poles at a and b.
Im
When |a| < |b| zero zero (a+b)/2
Re
a b
ROC
poles
If |b| < |a| the transform does not converge.
Re
b a
poles
In the above three examples we may express the z-transform both as a ratio of
polynomials in z (i.e., positive powers) and as a ratio of polynomials in z–1 (negative powers).
From the definition of the z-transform, we see that for sequences which are zero for n < 0, X(z)
involves only negative powers of z. However, reference to the poles and zeros is always in terms
of the roots of the numerator and denominator expressed as polynomials in z. Also, it is
sometimes convenient to refer to X(z), written as a ratio of polynomials in z (i.e., positive power
of z), as having poles at infinity if the degree of the numerator exceeds the degree of the
denominator or zeros at infinity if the numerator is of smaller degree than the denominator.
Example 4.1.4 [Finite-length sequence] Only a finite number of sequence values are non-zero,
as given below.
x(n) = 0 for n < N1 and for n > N2, where N1 and N2 are finite
non-zero for N1 n N2
n N1
Convergence of this expression requires simply that |x(n)| < for N1 n N2. Then z may take
on all values except z = if N1 is negative and z = 0 if N2 is positive. Thus the ROC is at least 0
< |z| < and it may include either z = 0 or z = depending on the sign of N1 and N2.
(2) Translation (Time-shifting) If ʓ[x(n)] = X(z) with ROC r1<|z|< r2 then ʓ[x(n–k)] = z–k X(z)
with the same ROC except for the possible addition or deletion of z = 0 or z = ∞ due to z–k.
Example Given x(n) = {1, 2} and x2(n) = x(n+2) find X(z) and X2(z) and their respective ROCs.
X(z) = 1+ 2z 1 , ROC: entire z-plane except z = 0; X2(z) = z 2 (1+ 2z 1 ) = z2 2z , ROC: entire z-
plane except z = ∞.
(5) Time reversal If ʓ[x(n)] = X(z) with ROC r1 <|z|< r2 then ʓ[ x(–n)] = X (z 1) with ROC
1/ r2 <|z|< 1/ r1
Example Given x(n) = 2n u(n) and X 2 (z) = z X (z1 ) determine x2(n).
z
x(n) = (0.5)n u(n) , X(z) = , ROC: 0.5 <|z|
z 0.5
ʓ-1{ X (z1 ) } = x(–n); x2(n) = ʓ-1{ z X (z1 )} = x(–(n+1)).= 2((n1)) u((n 1))
(6) Convolution in time domain leads to multiplication in frequency domain Given ʓ[x(n)] =
X(z) with ROC zRx and ʓ[y(n)] = Y(z) with ROC zRy and x(n)*y(n) = x(k)h(n k) then
k
(7) Multiplication in time domain leads to convolution in frequency domain If ʓ[x(n)] = X(z)
with ROC rx1 <|z|< rx2 and ʓ[y(n)] = Y(z) with ROC ry1 <|z|< ry2 then
z
ʓ[x(n).y(n)] = j21 X (v)Y v v 1dv , ROC rx1 ry1 <|z|< rx2 ry2.
C2
where is a complex contour integral and C2 is a closed contour in the intersection of the ROCs
C2
of X(v) and Y(z/v).
(8) Initial Value Theorem If x(n) is a causal sequence with z transform X(z), then
x(0) = lim X (z)
z
(9) Final Value Theorem If ʓ[x(n)] = X(z) and the poles of X(z) are all inside the unit circle then
the value of x(n) as n→ is given by
x(n) n = lim [(z 1) X (z)]
z 1
1
Some also give this as x(n) n = lim [(1 z ) X (z)]
z 1
ʓ[δ(n)] = (n) z
n
n =1. z0 = 1, ROC all z
ʓ[δ(n–k)] = (n k) z
n
n
=1. z–k = z–k, ROC |z| > 0 if k > 0 (|z| < if k < 0)
ʓ[u(n)] = u(n) z n
= 1 z n = 1+ z–1 + z–2 +…
n n0
z
1 = , ROC |z–1| < 1 or |z| > 1
=1 z 1 z 1
(3) Unit step –u(–n–1) (negative time):
1 1 0
ʓ[–u(–n–1)] = u(n 1) z
n
n
= (1) z
n
n
=– z n
n
= 1 – z n
n
z
=1 – (1 + z + z2 +…) = 1 – 1 = , ROC |z| < 1
1z z1
(4) Exponential anu(n) , derived in earlier example:
z
ʓ[ anu(n) ] = , ROC |z| > |a|
za
(5) Exponential bnu(n 1) ; negative time; derived earlier:
z
ʓ[ bnu(n 1) ] = , ROC |z| < |b|
z b
z
(6) Unit ramp n u(n). Given that ʓ[u(n)] = U(z) =
z 1
dU (z) d z z [(z 1).1 z .1]
ʓ[n u(n)] = – z = –z =
dz dz z 1 (z 1)2
z
= ROC |z| > 1, same as that of U(z)
(z 1) 2
z sin 0
(7) Sinusoid sin 0n u(n) : ʓsin 0 n u(n)= 2 , ROC |z| > 1
z 2 z cos 0 1
e j 0 n e j 0 n
ʓsin 0 n u(n)= sin 0 n z n = z n
j
n0
1 j
n 0 2
n
j
0 1
n
=
j 2 z 0 z1
n0
e
n0
1 1 1
= , ROC | e j0 z1 | < 1 or |z| > 1
j 2 1 e j0 z1 1 e j0 z1
= 1 z j z
j
0
j2 z e 0
z e
z (z e ) (z e j0 )
j 0
= 2
j 2 z z (ej0 e j0 ) 1
z (e j 0 e j 0 )
= 2
j 2 z z (ej 0 e j0 ) 1
Using the identities
e j0 e j0 e j0 e j0
cos 0 n = and sin 0 n =
2 j2
we have
z sin 0
ʓsin 0 n u(n) = 2 , ROC |z| > 1
z 2 z cos 0 1
As an extension, using property #3,
ʓ a n sin 0 n u(n) = (z / a) sin 0 az sin 0 , ROC |z| > a
= 2
(z / a) 2 (z / a) cos 0 1 z 2 az cos 0 a 2
2
e j 0 n e j 0 n
(8) Cosinusoid cos 0 n u(n). Using the relation cos 0 n = and a procedure similar to
2
that for the sinusoid we get
ʓcos n u(n) = z z cos 0 ,
2
0 2 ROC |z| > 1
z 2 z cos 0 1
As an extension, using property #3,
2 2
ʓ a cos n u(n) =
n (z / a) (z / a) cos 0 z az cos 0 , ROC |z| > a
= 2
(z / a) 2 (z / a) cos 0 1 z 2 az cos 0 a 2
0 2
x(n) = a
i 1
n
i u(n)
ROC,
Im |z| > Largest |ai|
z-plane
Largest |ai|
Re
All other ai
inside circle
Since the ROC for a translated exponential remains the same as that for the original
exponential, all right-sided sequences that are sums of translated exponentials have ROCs similar
to that expressed above.
By a similar argument all left-sided sequences expressible as a sum of translated complex
exponentials have a ROC, L, given by
L = {z: |z| < smallest of |bi|}
If we have a combination of right- and left-sided sequences, the corresponding ROC is
the intersection of R and L. Therefore the total ROC becomes an annular region as shown below
and given by
RTotal = R L = {z: Largest of |ai| < |z| < smallest of |bi|}
Annular region Im
is the total ROC Largest ai
Smallest bi
Re
Theorem A linear shift-invariant system with system function H(z) is BIBO stable if and only if
the ROC for H(z) contains the unit circle.
This theorem can be used to determine stability for a given H(z) without obtaining the
impulse response or checking outputs for all bounded input signals.
Illustration of stability and causality For A system function with 2 poles at, say, z = 0.5, and z
= 1.5, there are three possible regions of convergence.
(1) ROC is 0.5 < |z| < 1.5. Here the system is stable since the unit circle is inside the
region of convergence. The impulse response, h(n), is two-sided, so the system is noncausal.
Im
ROC
Unit circle
Re
0.5 1.5
(2) ROC is |z| < 0.5. Here the system is not stable. The impulse response, h(n), is left-
sided, so the system is noncausal.
Im
Re
0.5 1.5
(3) ROC is |z| > 1.5. Here the system is not stable. The impulse response, h(n), is right-
sided, so the system may be causal.
Im
ROC
0.5 1.5
Re
1
As in Laplace transforms, in order to expand a rational function into partial fractions, the
degree of the numerator should be less than the degree of the denominator – proper fraction. If it
is not then we perform long division as below where Q(z) is the quotient and N1(z) is the
remainder.
N (z) N (z)
X(z) = = Q(z) + 1
D(z) D(z)
Long Division
Q(z) ←Quotient
Denominator→ D(z) N(z) ←Numerator
---
N1(z) ←Remainder
The long division is done until we get a remainder polynomial N1(z) whose degree is less than
the degree of the denominator D(z). We then obtain x(n) as
N z
x(n) = ʓ-1{X(z)} = ʓ-1{Q(z)} + ʓ-1 1
D(z)
Since N1(z)/D(z) is a proper fraction it can be expanded into partial fractions. The overall inverse
transform is obtained by looking up a table of z-transform pairs.
However, there is an alternative available in the case of z-transforms which is not
available in Laplace transforms. This is a result of the fact that z-transforms are characterized by
a z in the numerator (as can be verified by looking at a table of z-transforms). Therefore, instead
of expanding X(z) we may, instead, expand [X(z)/z] into partial fractions giving
X (z) A + B +…
z = z z1 z z2
so that X(z) is given by
Az Bz
X(z) = + +…
z z1 z z 2
This can be inverted by a simple look-up of a table of transforms. Note also that in some cases
X(z) = N(z)/D(z) may not be a proper fraction but [X(z)/z] is and, therefore, this method obviates
the need for long division of N(z) by D(z). (In still other cases even [X(z)/z] may not be a proper
fraction. See later under “General procedure for partial fraction expansion”.)
Example 1.5.1 (See also long division later). Find the inverse z-transform, using partial
fractions, of
X(z) = 2 z 3 z = N(z)
2
z 2 3 z 2 D(z)
This is not a proper fraction since the degree of the numerator is not less than the degree of the
denominator. However, (X(z)/z) is a proper fraction
X (z) 2 z3 2z3
= 2 =
z z 3 z 2 (z 1) (z 2)
which has the partial fraction expansion
X (z) = 1 + 1 z
or X(z) = z +
z (z 1) (z 2) (z 1) (z 2)
By looking up a table of z-transforms the inverse z-transform is
Note that we are giving here the causal solution that corresponds to a ROC |z| > 2 (not 1 < |z| <
2 or |z| < 1) so that x(n) is a right-sided sequence.
The alternative method is to divide N(z) by D(z) as below (as is standard practice in
Laplace transforms). Note that in this long division the numerator and denominator polynomials
are arranged in the order of decreasing powers of z. There are three other ways (all of them
wrong) of arranging the two polynomials for the long division.
Long Division
2 ←Quotient
Denominator→ z –3z + 2 2z – 3z
2 2
←Numerator
2z2 – 6z + 4
3z – 4 ←Remainder
In MATLAB (Partial fractions) The partial fractions may be computed by using the residuez
function. In this method X(z) is arranged as a ratio of polynomials in negative powers of z and, in
the denominator, the leading coefficient a0 0. See “General procedure for partial fraction
expansion” later.
2 3 z 1 = K + R1 R2
X(z) = 1 2 1 +
1 3 z 2z 1 p1z 1 p2 z 1
We define the coefficient vectors b = [2, -3] and a = [1, -3, 2]; R = [R1, R2] represents the
residues (partial fraction constants), p = [p1, p2] the poles and K a constant.
%Partial fractions
b = [2, -3], a = [1, -3, 2],
[R, p, K] = residuez (b, a)
The MATLAB output tells us that the poles are at z = 2 and z = 1 and the corresponding residues
are, respectively, 1 and 1. Further K = 0. Therefore,
2 3 z 1 1 1 z z
X(z) = 1 2
=0+ + = +
1 3 z 2z 1 2z 1 11z 1 z 2 z 1
1 1 obtained by the residuez function and X (z) 1 1
Note that the X(z) = 1 + = + are
1 2z 11z 1
z (z 1) (z 2)
the same since X(z) has no repeated poles. This won’t be the case if X(z) has repeated poles.
is BIBO stable or not. Find its transfer function and impulse response. Sketch its pole-zero plot.
Solution Take the z-transform of both sides:
= 2 (z 1) / z 2 = 2 z(z 1)
Y (z) = 1 z
H(z) =
X (z) 1
1 z 0.5z 2
(z z 0.5) / z z z 0.5
Im
Unit circle Pole at 0.5 + j 0.5
Re
Zero at –1 1
Zero at 0
Pole at 0.5 – j 0.5
The impulse response is given by h(n) = ʓ-1{H(z)}. We need partial fractions for H(z);
we shall instead handle H(z)/z:
H (z) z 1 z1
= 2 =
z z z 0.5 (z 0.5 j0.5) (z 0.5 j0.5)
*
A A
= +
z 0.5 j0.5 z 0.5 j0.5
*
Solving for A and A , we get
z 1
A= 0.5 j0.5 1 1.5 j0.5
= =
z 0.5 j0.5z 0.5 j 0.5 0.5 j0.5 0.5 j0.5 j
1
= 0.5 – j1.5 = 5 / 2 e j tan 3
A* = 0.5 + j1.5
Thus we have
*
H (z) A A
= +
z z (0.5 j0.5) z (0.5 j0.5)
z z
H(z) = A + A*
z (0.5 j0.5) z (0.5 j0.5)
=a =b
where
1
e j / 4
1
a = 0.5 + j0.5 = 0.52 0.52 e j tan 1 =
2
1
b = 0.5 – j0.5 = e j / 4
2
The inverse z-transform is
h(n) = A an + A* bn, n 0
0, otherwise
So that for n 0,
1 / 4 n * 1 j / 4
n
h(n) = A e j
+ A e
2 2
1 j n / 4
n n
* 1 jn/4
= A e +A e
2 2
n n
1 3 1 3 1 j n / 4
= j e j n / 4 + 1j e
2 2 2 2 2 2
n n
1 1
= ( e j n / 4 + e j n / 4 ) + j 3 1
( e j n / 4 + e j n / 4 )
2 2 2 2
n n
1 e j n / 4 e j n / 4 3 1 e j n / 4 e j n / 4
= +j j2
2 2 2 2 j2
cos (n/4)
1 1 e j n / 4 e j n / 4
n n
= cos (n/4) + 3
2 2 j2
sin (n/4)
To sum up,
1
n
H(z) = z(z 1) = z z
z z 0.5
2
z z 0.5
2
into those forms. Comparing the denominator of H(z) with the denominator of the transforms of
the sine and cosine functions
az sin 0
ʓ a n sin 0 n u(n) == 2
z 2 az cos 0 a 2
, ROC |z| > a
and 2
ʓ a cos n u(n) = z az cos 0 ,
n
ROC |z| > a
z 2 2 az cos 0 a 2
0
we get
z 2 z 0.5 = z 2 2az cos0 a 2
from which
1
a2 = 0.5 → a = , 2a cos 0 = 1 → ω0 = /4,
2
1 1
cos 0 = , a cos 0 = ½, sin 0 = , a sin 0 = ½
2 2
The numerators of the two transforms then are
1 1 1 1 1 1
az sin0 = z az cos0 = z
2 2 2
z = z and z = z z
2 2 2 2 2 2
1 1
In light of these we manipulate the numerator of H(z) so that it will contain z and z z
2
2 2
2 1 3
Numerator = z z = z z z
2
2 2 2 1 1 1
Denominator = z 2
z 0.5 = z 2 z 2
2 2 2
Thus
z2 1 z 3 z 1 1
2 2 z z
2
z2z z
H(z) = = = 2 2 +3 2 2
z 2 z 0.5 z2 z 0.5 z z 0.5 z z 0.5
We have, in effect, arranged H(z) as
1 1 1 1
z 2 z z
H(z) = z 2 1 2 1 2 1 2 2
z 2 + 3 z 2 2
2
z 2
1 1 1
2
2 2 2 2 2
Therefore,
2 1 1
z 2z z
h(n) = ʓ-1{H(z)} = ʓ-1 2 +3 ʓ-1 2
2
z z 0.5 z z 0.5
n n
1 1
= cos(n / 4) u(n) +3 sin(n / 4) u(n)
2 2
%Pole-zero plot
b = [1, 1]; a = [1, -1, 0.5]; zplane (b, a)
0.8
0.6
0.4
Imaginary Part
0.2
-0.2
-0.4
-0.6
-0.8
-1
-1 -0.5 0 0.5 1
Real Part
In MATLAB (Partial fractions) The partial fractions may be computed by using the residuez
function as below. Note that H(z) is arranged as a ratio of polynomials in negative powers of z.
1 z1 R1 R2
H(z) = =K+ +
1 z1 0.5z2 1 p1z 1 1 p2 z 1
We define the coefficient vectors b = [1, 1] and a = [1, -1, 0.5]; R = [R1, R2] represents the
residues (partial fraction constants), p = [p1, p2] the poles and K a constant.
%Partial fractions
b = [1, 1], a = [1, -1, 0.5],
[R, p, K] = residuez (b, a)
Therefore,
1 z1 0.5 j1.5 0.5 j1.5
H(z) = =0+ +
1 z1 0.5z2 1 (0.5 j0.5)z 1 1 (0.5 j0.5)z 1
z
Example 1.5.3 Find the inverse transform of X(z) = , where the ROC is (a) |z| > 1,
3z 4z 1
2
1 1
A= =1/2, and B= = –1/2
3z (1/ 3)z 1 3z 1z 1/ 3
X (z) (1/ 2) (1/ 2)
= +
z z 1 z (1/ 3)
X (z) = (1/ 2)z + (1/ 2)z
z 1 z (1/ 3)
The inverse is
(1/ 2)z (1/ 2)z (1/ 2)z -1 (1/ 2)z
x(n) = ʓ-1{X(z)} = ʓ-1 = ʓ-1 + ʓ
z 1 z (1/ 3) z 1 z (1/ 3)
The ROC is outside the largest pole signifying a right-sided sequence for each pole. The inverse
becomes
1 1 n 1 1 1 n
1 n
x(n) = (1) u(n) – u(n) = u(n) – u(n)
2 2 3 2 2 3
(b) For ROC ≡ |z| < (1/3). The partial fraction expansion does not change. Since the ROC is
inward of the smallest pole, x(n) consists of two negative-time sequences.
(1/ 2)z (1/ 2)z
x(n) = ʓ-1{X(z)} = ʓ-1 + ʓ-1
z 1 z (1/ 3)
= (–1n) u(–n–1) – (1/ 3) u(–n–1)
1 1 n
2 2
= (1/ 2)1 (1/ 3)n u(n 1)
(c) For ROC ≡ (1/3) < |z| < 1. The partial fraction expansion stays the same. The pole at z = 1
corresponds to a negative-time sequence (left-sided sequence) while the pole at z = 1/3 gives a
positive-time sequence (right-sided sequence).
(1/ 2)z (1/ 2)z (1/ 2)z -1 (1/ 2)z
x(n) = ʓ-1{X(z)} = ʓ-1 = ʓ-1 + ʓ
z 1 z (1/ 3) z 1 z (1/ 3)
n n
Example 1.5.4 (Sometimes there is no z in the numerator to factor out, but we still can divide
z 1
X(z) by z as in this example.) Find x(n) for X(z) = 2 where the ROC is |z| > 1.
3z 4z 1
Solution
z 1 z1 C
X (z) = = A+ B +
z = z(3z 4z 1) 3z(z 1)z (1/ 3)
2
z z 1 z (1/ 3)
z1 1
A= = =1
3(z 1)z (1/ 3)z 0 3(1)1/ 3
z1
B= = …= 1
3zz (1/ 3)z 1
z1
C= = …= –2
3z(z 1) z 1/ 3
X (z) = 1 + 1 2
–
z z z 1 z (1/ 3)
z z
X (z) = 1 + –2
z1 z (1/ 3)
1
n
2a 2 (1)
0.1 0.01 2.24 0.1 2.25 0.1 1.5 = 0.8 and –0.7
= = =
2 2 2
2
(z 1)
X(z) =
(z 0.8)( z 0.7)
2
X (z) (z 1) A B C
= = + +
z z (z 0.8) ( z 0.7) z z 0.8 z 0.7
(z 1)2
A= = …= –1/0.56 = –1.79
(z 0.8) ( z 0.7) z0
(z 1) 2
B= = …= 1/30
z ( z 0.7) z 0.8
(z 1)2
C= = …= 2.75
z ( z 0.8) z 0.7
X (z) 1.79 (1/ 30) 2.75
= + +
z z z 0.8 z 0.7
(1/ 30) z 2.75 z
X (z) = –1.79 + +
z 0.8 z 0.7
1
x(n) = ʓ-1{X(z)} = 1.79 δ(n) + (0.8)n u(n) + 2.75 (0.7)n u(n)
30
1
Example 1.5.6 Find the inverse z-transform of X(z) = , |z| > ½.
z (1/ 2)z (1/ 4)
Solution
1 A C
X (z) = + B
= zz (1/ 2)z (1/ 4) + z (1/ 4)
z z z (1/ 2)
1
A= = …= 8
z (1/ 2)z (1/ 4)z 0
1
B= = …= 8
z z (1/ 4)z 1/ 2
1
C= = …= –16
z z (1/ 2)z 1/ 4
X (z) = 8 + 8 16
–
z z z (1/ 2) z (1/ 4)
8z 16 z
X (z) = 8 + –
z (1/ 2) z (1/ 4)
n n
z
There is a pole at z = ∞. The numerator degree is 3 and is greater than the denominator degree.
By long division we reduce the numerator degree by 2 so that the resulting numerator degree is
less than that of the denominator 3 degree.
3 (23 /16)z (3 / 32)
+
4 z 2 (3 / 4)z (1/ 8)
X (z) z z = z
z = z 2 (3 / 4)z (1/ 8)
(Note that in the long division leading to the above result the numerator and denominator
polynomials are arranged in the order of decreasing powers of z. There are three other ways (all
of them wrong) of arranging the two polynomials for the long division.)
The proper fraction part can now be expanded into partial fractions:
(23 /16)z (3 / 32) = A B
+
z (3 / 4)z (1/ 8)
2
z (1/ 2) z (1/ 4)
(23 /16)z (3 / 32)
A= = 5/2
z (1/ 4) z 1/ 2
4 z 2 (3/ 4)z (1/ 8)
1
4
where
(23/16)z 2 (3/ 32)z (23/16) (3/ 32)z 1
X1(z) = 2 = 1 2
z (3/ 4)z (1/ 8) 1 (3/ 4)z (1/ 8)z
On which we may use the residuez function.
z 4
Example 4.5.8 Assuming that H(z) = is a causal system function, prove the following
z 5
independently of each other
(a) h(n) = –(4/5) (n) + (9/5) 5n u(n)
(b) h(n) = 5n u(n) + (4) 5n1 u(n-1)
(a) h(n) = (n) + (9) 5n1 u(n-1)
Solution (a) H (z) = (4 / 5) + (9 / 5) , (b) H (z) = z + 4 , (c) By long division H (z) =
z z z 5 z 5 z 5
9
1+ .
z5
Example 4.5.9 Partial fractions can be obtained with the z-transform, say H(z), expressed as a
ratio of polynomials in negative powers of z. This amounts to expanding H(z)/z into partial
fractions. Here is an example:
8z3 4z 2 11z 2
z (1/ 4)z 2 z (1/ 2)
H(z) =
This example is from “Parallel realization of IIR filters”, towards the end of this Unit where we
obtain
H (z) 16 8 (16) z 20
= +
z z (1/ 4) z z (1/ 2)
+ 2
z
However, we may also proceed with negative powers of z as below (we may view z–1 = p as a
new variable):
8z 3 4z 2 11z 2 8 4z 1 11z 2 2z 3
z (1/ 4)z 2 z (1/ 2) 1 0.25z 1 1 z 1 0.5z 2
H(z) = =
By long division we reduce the degree of the numerator by 1 and then expand the proper fraction
part into partial fractions:
Long Division
16 ←Quotient
Denominator→ – 0.125z–3 + 0.75z–2 – 1.25z–1 + 1 – 2z–3 + 11z–2 – 4z–1 + 8 ←Numerator
– 2z–3 + 12z–2 – 20z–1 + 16
– z–2 + 16z–1 –8 ←Remainder
8 16z 1 z 2
H(z) = 16 +
11.25z 1 0.75z 2 0.125z 3
Let
8 16z 1 z 2 A Bz 1 C
11.25z 1 0.75z 2 0.125z 3 1 0.25z 1 1 z 1 0.5z 2
= +
%Partial fractions
b = [8, -4, 11, -2], a = [1, -1.25, 0.75, -0.125],
[R, p, K] = residuez (b, a)
Therefore,
8 j12 8 j12 8
H(z) = 16 + + +
1 (0.5 j0.5)z 1 1 (0.5 j0.5)z 1 1 0.25 z 1
Inverse z-transform when there are repeated roots With repeated roots, that is, a k-th order
pole at z = a we have X(z) in the form
z
X(z) = , ROC |z| > |a|
(z a) k
The table below gives the inverse z-transforms for several values of k and for the general case of
arbitrary k.
Repeated Roots
X(z) x(n) = ʓ-1[X(z)] for ROC |z| > |a|
z an u(n)
(z a)
z n n 1
a u(n)
(z a)2 1!
z n (n 1) n 2
a u(n)
(z a)3 2!
z n (n 1)(n 2) n 3
a u(n)
(z a)4 3!
… …
z n (n 1)(n 2)...(n k 2) n k 1
(z a)k a u(n)
(k 1)!
General procedure for partial fraction expansion Since X(z)/z must be rational, it takes the
form
X (z) K z K 1 z .......... 1 z 0
K K 1
=
L z L1 z .......... 1 z 0
L L1
z
If K < L then no adjustment is needed. The partial fraction expansion is straightforward.
If K ≥ L then divide until the remainder polynomial in z has a degree of L–1 or less:
L1
X (z) = (c zK–L + … +c z + c ) + dL1 z .......... d1 z d0
K–L
z
1 0
L z L L1 z L1 .......... 1 z 0
The first part of the above expression, (cK–LzK–L + … +c1z + c0), will eventually contribute δ
functions to the output sequence some of which are time-advanced so that the resulting x(n) will
be noncausal. The second part – the proper fraction – is expanded into partial fractions. Assume
we have one repeated pole of order m, call it z1, and that all the rest are distinct, call them zm+1,
zm+2,…, zL. Then let
d z L1 .......... d z d
(z) = L1 1 0
Lz L L1
z L1 .......... 1 z
0
L
Bj
Am Am1 A
+…+
z z1 j m1 z z j
= + 1
+
z z1 m z z1 m1
The coefficients Aj (m of them) and Bj ( L m of them) are found as follows:
Aj = 1
d m j (z z )m (z) , j = 1, 2, …, m
(m j)! dz m j z z1
1
Bj = [(z z j ) (z)] , j = m+1, m+2, …, L
zzj
In the resulting x(n) the contribution of the Aj terms is a number of exponentials multiplied by n,
(n–1), (n–2), etc., and the contribution of the Bj terms is a number of complex exponentials.
z 0.5
B2 = = = –1
z 1z 0.5 0.5 1
d z = (z 1).1 z(1) (0.5 1) (0.5)
B1 = = =4
z 1 z 0.5 z 1 0.5 1
2 2
dz z 0.5
Thus
(4) (1) 4
H(z) = + +
z 1 z 0.5 2
z 0.5
Taking the inverse z-transform,
1 1 1
h(n) = –4 ʓ-1 –1ʓ-1 + 4 ʓ-1
z 0.5
z 1 2
z 0.5
1 z 1 z 1 z
= –4 ʓ-1 z –1ʓ-1 z + 4 ʓ-1 z
z 0.5
z 1
2
z 0.5
n
= –4 (1) n u(n)n n1 –1 (0.5) u(n) + 4 (0.5) n u(n) n n1
n1
1! n n1
= 4 (1)n u(n 1) –4 (n 1)(0.5)n u(n 1) – 8 (0.5)n u(n 1)
1 1
D2 = = =2
z 1z 0.5 0.5 1
d 1 = (z 1).0 1(1) 1 = –4
D1 = =
dz z 1 z 0.5 z 1 z 0.5 0.5 1
2 2
Thus
H (z) 4 2 (4)
= + +
z z 1 z 0.52 z 0.5
z z z
H(z) = 4 +2 –4
z 1 z 0.52 z 0.5
Taking the inverse z-transform,
z z z
h(n) = 4 ʓ-1 + 2 ʓ-1 – 4 ʓ-1
z 0.5
z 1 2
z 0.5
n
= 4 (1)n u(n) + 2 (0.5) u(n) – 4 (0.5) u(n)
n1 n
1!
= 4 (1)n u(n) – 4 n(0.5)n u(n) – 4 (0.5)n u(n)
z z
H(z) = 3 =
z 2z 2 1.25z 0.25 1 2z1 1.25z 2 0.25z3
2
z z
H(z) =
z 1z 0.52 1 1 z 1 1 0.5z 1 2
=
E F1 F2
+ +
1 1 z 1 1 0.5z 1 1 0.5z 1 2
=
(We have ordered the coefficients in the order in which MATLAB displays them). We can define
z 1 = v so that z = –1 corresponds to v = –1 and z = –0.5 to v = –2. The transform now appears as
v2 E F F
H(v) = = + 1
+ 2
z z2 z z
=4 – 4 =4 – 4z
z 1 z 0.5 z 1
2
z 0.52
Taking the inverse z-transform,
z z
h(n) = 4 ʓ-1 – 4 ʓ-1 z
z 1 z 0.5
2
n
= 4 (1)n u(n)– 4 (0.5)n1 u(n)
1! n n1
n
= 4 (1)n u(n)– 4 (0.5)1 (0.5)n u(n)
1! n n1
= 4 (1)n u(n)+ 8 (n 1)(0.5)n1 u(n 1)
In MATLAB This particular set of partial fractions may be computed by using the residuez
function:
z2 2 E F1 F2
H(z) = 1 2z1 1.25z 0.25z3 = K + 1 p z 1 + 1 p z 1 + 1 2
1 2
1 p2 z
We define the coefficient vectors b = [0, 0, 1] and a = [1, 2, 1.25, 0.25]; R = [E, F1, F2]
represents the residues (keyed to the above partial fraction coefficients), p the poles and K a
constant.
%Partial fractions
b = [0, 0, 1], a = [1, 2, 1.25, 0.25],
[R, p, K] = residuez (b, a)
R=
4
-0 + 0i
-4 - 0i
p=
-1
-0.5 + 0i
-0.5 - 0i
K=
[]
Therefore,
z2 4 0 (4)
H(z) = =0+ + +
1 2z1 1.25z 2 0.25z3
1 (1)z 1 1 (0.5)z 1 1 (0.5)z 1
2
4 + (4)
=
11z 1
1 0.5z 1
2
which agrees with the hand-calculated results.
z z
2 4
3 2
X (z) z z z (1/16) A B2 B1 C
= = + + +
zz 1/ 2 z 1/ 4 z z (1/ 2) z (1/ 2) z (1/ 4)
2 2
z
z z2 z (1/16)
3 (1/16)
A= = =1
z (1/ 2)2 z (1/ 4)z 0 1/ 22 1/ 4
z3 z2 z (1/16) (1/ 4)3 (1/ 4)2 (1/ 4) (1/16)
C= = =9
zz (1/ 2)
2
z 1/ 4
(1/ 4)(1/ 4) 1/ 2 2
z3 z2 z (1/16) (1/ 2)3 (1/ 2)2 (1/ 2) (1/16)
B2 = = = 5/2
zz (1/ 4) z 1/ 2
(1/ 2)(1/ 2) 1/ 4
d z 3 z 2 z (1/16) d z 3 z 2 z (1/16)
B1 = dz zz (1/ 4) = dz z2 (z / 4)
z 1/ 2 z 1/ 2
2 2
3 2
z (z / 4) 3z 2z 1 z z z (1/16) 2z (1/ 4)
=
z (z / 4)
2 2
z 1/ 2
=1–9
X (z) = + (5 / 2) (9) 9
+ +
z z z (1/ 2) z (1/ 2) z (1/ 4)
2
5 z z z
X (z) = 1+ 9 +9
2 z (1/ 2) 2
z (1/ 2) z (1/ 4)
Taking the inverse z-transform,
x(n) = ʓ-1{X(z)}
= ʓ-1{1} + (5/2)ʓ-1
z
–9ʓ-1 z
+ 9ʓ-1
z
z (1/ 2) z (1/ 2) z (1/ 4)
2
5 1
n n1u(n) –9 nu(n) + 9 u(n)
= δ(n) + n
1 1
2 2 2 4
Other possibilities If we choose to expand X(z), rather than X (z) / z , into partial fractions,
we need to perform long division to reduce the degree of the numerator by 1 resulting in
2
X (z) = 1 + (z / 4) (z / 2) = 1+ X (z)
z (5 / 4)z (1/ 2)z (1/16)
3 2 1
In MATLAB The partial fractions may be computed by using the residuez function:
1 z1 z2 (1/16)z3 R1 R R
X(z) = =K+ + 2
+ 3
1 2
1 (5 / 4)z (1/ 2)z (1/16)z 3 1
1 p1 z 1
1 p2 z
1 p2 z 1 2
We define the coefficient vectors b = [1, -1, 1, -1/16] and a = [1, -5/4, 1/2, -1/16]; R represents
the residues (partial fraction coefficients), p the poles and K a constant. Note that in the
numerator z 3 means M = 3, and in the denominator z 3 means N = 3; since M is not less than N
this is not a proper rational function, so that K will have a nonzero element(s).
%Partial fractions
b = [1, -1, 1, -1/16], a = [1, -5/4, 1/2, -1/16],
[R, p, K] = residuez (b, a)
z2z
Example 1.5.12 Find the inverse of X(z) = for ROC |z| > ½.
z1 z (1/ 2)
A3
3
z (1/ 4) A1 B
X (z) = A2 + +
z = z (1/ 2) z (1/ 4) z (1/ 2) z (1/ 2) z (1/ 2) z (1/ 4)
3 3 + 2
z 1 (1/ 2) 1
A3 = = =6
z (1/4)z 1/ 2 (1/ 2) (1/ 4)
1 d z 1
A2 = (3 2)! dz z (1/4) = …= –20
z 1/ 2
1 d 2 z 1
A1 = (3 1)!dz 2 z (1/ 4) = …= 80
z 1/ 2
z 1
= …= –80
z (1/ 2)3 z 1/ 4
B=
=6
1 1 1
2 ! 2 2 2 4
The u(n) may be factored out etc.
MATLAB
z 2 z 3
X(z) =
1 (7 / 4)z 1 (9 / 8)z 2 (5/16)z 3 (1/ 32)z 4
%Partial fractions
b = [0, 0, 1, 1], a = [1, -7/4, 9/8, -5/16, 1/32],
[R, p, K] = residuez (b, a)
1.44 + 0.0i
-0.88 - 0.0i
0.24
-0.80
p=
0.5 + 0.0i
0.5 - 0.0i
0.5
0.25
K=
[]
a
k 0
k y(n k) = br x(n r)
r 0
System function Take the z-transform of both sides of the above equation
N M
ʓ ak y(n k) = ʓ br x(n r) , or
k 0 r 0
N M
a z k
N M r
k Y (z) = br z X (z) , or
k0 r0
N M
k0 r 0
M
Y (z) b z
r0
r
r
a z
X (z) k
k
k0
Unit sample response If x(n) = δ(n) then X(z) = ʓ[x(n)] = ʓ[δ(n)] = 1. The corresponding y(n) is
the unit sample response h(n). We have
Y (z)
= H(z), or Y(z) = H(z).X(z) = H(z).1 = H(z)
X (z)
So, given H(z), the system function, the unit sample response is h(n) = ʓ-1[H(z)].
The difference equation from the H(z) The system function H(z) is first written in terms of
Y (z)
negative powers of z and set equal to . Then cross-multiply and take the inverse z-transform
X (z)
to get the difference equation.
Frequency response of the system is the Fourier transform (DTFT) of the unit sample response
h(n):
H (e j
) = h(n) e j n
n
Compare this with the system function H(z) defined as the z-transform of the unit sample
response h(n)
H(z) = h(n) z n
n
Thus the frequency response, if it exists, can be obtained by replacing the z in H(z) by e j as
follows:
j
H (e ) h(n) e
n
j n
= H (z) z e j
Set z = e j H (e j )
Causality in terms of the z-transform, H(z), and the ROC A causal LTI system has an
impulse response h(n) = 0 for n < 0, and is, therefore, a right-sided sequence. This also implies
that the ROC of H(z) is the exterior of a circle in the z-plane. For a causal system the power
series
H(z) = h(n) z
n0
n
= h(0) + h(1) z –1 + h(2) z –2 + … → Eq. (1)
does not include any positive powers of z. Consequently, the ROC includes z = . Therefore, we
have the principle:
A discrete-time LTI system is causal if and only if the ROC of its system function is the
exterior of a circle, and includes z = .
The initial value theorem says that for a causal sequence, h(n), the initial value is given by
h(0) = lim H (z)
z
This may be seen by setting z→ in Eq. (1) making all terms go to zero except the term h(0).
Thus, for a causal sequence, h(n), if h(0) is finite, then, lim H (z) is finite. Consequently, with
z
H(z) expressed as a ratio of polynomials in z (positive powers of z), the order of the numerator
polynomial cannot be greater than the order of the denominator polynomial (if it were there
would be positive powers of z in the power series of H(z), corresponding to non-zero h(n) for
negative n; also z = ∞ would not be included in the ROC); or, equivalently, the number of finite
zeros of H(z) cannot be greater than the number of finite poles.
The above discussion is summed up as follows: A discrete-time LTI system with rational
system function H(z) is causal if and only if
1. The ROC is the exterior of a circle outside the outermost pole, and,
2. With H(z) expressed as a ratio of polynomials in z, (positive powers of z), the
order of the numerator is not greater than the order of the denominator.
Condition 1 alone is not enough because the sequence may be right-sided but not causal.
If H(z) is represented as a ratio of polynomials in z as
K z K K 1 z K 1 .......... 1z 0 → Eq. (2)
H(z) =
L z L1 z .......... 1 z
L L1
0
then L K if the system is causal – in other words denominator degree numerator degree. On
the other hand, if we write H(z) as the ratio of polynomials in z 1 (negative powers of z) as
b b z 1 .......... b z M 1 b z M
H(z) = 0 1 M 1 M
a0 a z1 1 .......... a N 1 z N 1 aN z N
M 1 M
b (b1 / z) .......... (bM 1 / z ) (bM / z )
= 0 N 1
a0 (a1 / z) .......... (a N 1 / z ) (aN / z N )
then, if the system is (to be) causal, a0 0. This is seen by setting z→ , and requiring that h(0)
= (b0/a0) be finite. This is illustrated with an example where a0 = 0, e.g.,
1 z 1 z 2 z 2 z 1
H(z) = =
0 z 1 z 2 z1
which, by long division, can be seen to contain z1 – a positive power of z – hence non-casual.)
Note When H(z) is written as a ratio of polynomials in z (positive power of z), as in Eq. (2), we
have required that L K for causality. These L and K are not to be confused with the N and M
contained in the difference equation. Consider, for example, the system
X (z) 1 a z 1 z 1 (z a) z 2 (z a)
and it is seen that the numerator degree (K = 3) is not greater than the denominator degree (L =
3). Thus the system is causal.
As another example consider y(n) + a y(n–1) = x(n) + b x(n+1) which is non-causal
because of the x(n+1) term. The transfer function is
H(z) = Y (z) = 1 b z = z(b z ) = (b z ) =
1 1 1 (b z 1 )
X (z) 1 a z 1 1 a z 1 z 1 a z 2 0 z 1 a z 2
Note that, when the numerator and denominator are expressed in terms of negative powers of z,
“a0” = 0. On the other hand, when the numerator and denominator are expressed in terms of
positive powers of z, we have
2
H(z) = Y (z) = b z z
X (z) z a
with the numerator degree greater than the denominator degree.
(Omit) Rational transfer function; LTI system Given the system with the Nth order difference
equation,
a0 y(n) + a1 y(n–1) + … + aN y(n–N)
= b0 x(n) + b1 x(n–1) + … + bM x(n–M), a0 0
a
k 0
k y(n k) = br x(n r) ,
r 0
a0 0
(Note that some authors take the coefficient of y(n), a0, to be 1. In the above difference equation
we may divide through by a0 so that the coefficient of y(n) is 1).
We can find the transfer function of the system by taking the z-transform on both sides of
the equation. We note that in finding the impulse response of a system and, consequently, in
finding the transfer function, the system must be initially relaxed (“zero initial conditions”).
Thus, if we assume zero initial conditions, we can use the linearity and time-shift properties to
get
N M
Y(z) ak z = X(z)
k
b z r
r
k0 r0
so that
M
H(z) = Y (z) = b z
r0
r r
Eq. (1)
X (z) a z
N
k k
k0
The corresponding impulse response can be found as h(n) = ʓ–1{H(z)}. The poles of the system
transfer function are the same as the characteristic values of the corresponding difference
equation. For the system to be stable, the poles must lie within the unit circle in the z-plane.
Consequently, for a stable, causal function, the ROC includes the unit circle.
The system function, H(z), is a rational function:
M
b z
k
1 2 M k
H(z) = N (z) = b0 b1z 1 b2 z2 .......... bM z k0
a a z a z ......... a zN =
D(z)
a z
N
k
0 1 2 N
k
k0
Here N(z) and D(z) stand for numerator and denominator respectively. If a0 0 and b0 0, we
can avoid the negative powers of z by factoring out b0z–M and a0z–N as follows:
M 1
H(z) = N (z) = b0 z
M M
z (b1 / b0 )z .......... (bM / b0 )
. N N 1
D(z) a0z N z (a1 / a0 )z ......... (aN / a0 )
Since N(z) and D(z) are polynomials in z, they can be expressed in factored form as
b (z z ) (z z ).........(z z )
H(z) = N (z) 0 zN–M. 1 2 M
D(z) = a (z p ) (z p ).........(z p )
0 1 2 N
M
(z z ) k
=Cz N–M k 1
. N
, where C = (b0/a0)
(z p )
k1
k
Thus H(z) has M finite zeros at z = z1, z2, …, zM, and N finite poles at z = p1, p2,…, pN, and |N–M|
zeros (if N > M) or poles (if N < M) at the origin z = 0. Poles and zeros may also occur at z = .
A pole exists at z = if H( ) = , and a zero exists at z = if H( ) = 0. If we count the poles
and zeros at z = 0 and z = as well as the N poles and M zeros, we find that H(z) has exactly the
same number of poles and zeros.
By definition the ROC of H(z) should not (can not) contain any poles.
There is a zero at z = 0. Further, since the denominator degree is greater than the numerator
degree by 1 it is clear that H( ) = 0, so that there is an additional zero at z = ∞.
In MATLAB the transfer function is specified as a ratio of polynomials in z 1
0 1.z 1
H(z) =
1 1.z1 1.z 2
The numerator coefficients, {bi, i = 0 to M} and the denominator coefficients {ai, i = 0 to N} are
specified as the two vectors b = [0, 1] and a = [1, -1, -1].
%Pole-zero plot
b = [0, 1]; a = [1, -1, -1]; zplane (b, a)
1
0.8
0.6
0.4
Imaginary Part
0.2
-0.2
-0.4
-0.6
-0.8
-1
H(z) = z1 2z2 3z3 4z4 5z5 6z6 7z7 8z8 9z9
Solution From
z8 2z7 3z6 4z5 5z4 6z3 7z2 8z 9
H(z) =
z9
we can see that there are 9 poles at z = 0 and 8 zeros at sundry places and an additional zero at z
= ∞ owing to the denominator degree being greater than the numerator degree by 1.
For the MATLAB segment the numerator and denominator coefficients are taken from
0 z1 2z2 3z 3 4z4 5z5 6z 6 7z7 8z8 9z9
H(z) =
1
%Pole-zero plot
b = [0: 9]; a = [1, 0]; zplane (b, a)
0.5
Imaginary Part
0 9
-0.5
-1
For the MATLAB program the coefficient vectors are b = [1, 0.81, -0.81] and a = [1, 0,
0.45].
%Pole-zero plot
b = [1, 0.81, -0.81]; a = [1, 0, 0.45]; zplane (b, a)
0.8
0.6
0.4
Imaginary Part
0.2
-0.2
-0.4
-0.6
-0.8
-1
b z
r
r
r0
The all-zero system If ak = 0 for 1 k N, we have H(z) = . Either take a0 = 1 or
a0
consider that a0 is absorbed in the br coefficients, so that
M 1
H(z) = b b z1 b z2 ... b zM = b0 z b1z ... bM
M
0 1 2 M
th zM
In this case, H(z) contains M zeros and an M order pole at the origin z = 0. Since the system
contains only trivial poles (at z = 0) and M non-trivial zeros, it is called an all-zero system. Such
a system has a finite-duration impulse response (FIR), and is called an FIR system or a moving
average (MA) system. Note that the corresponding deference equation is
ak z k a0 a1 z a2 z ......... aN z
2 N
k0
b zN
= 0
. N N 1 N 2
a0 z (a1 / a0 )z (a2 / a0 )z ... (aN / a0 )
Here again, either take a0 = 1 or imagine that it is absorbed in the other coefficients viz., b0, a1,
a2, …, aN. Thus
bzN
H(z) = z N a z N 1 0 a z N 2 ... a
1 2 N
th
Here H(z) has N poles and an N order zero at the origin z = 0. We usually do not make reference
to these trivial zeros. As a result this system function contains only non-trivial poles and the
corresponding system is called an all-pole system. Due to the presence of the poles, the impulse
response of such system is infinite in duration, and hence it is an IIR system. (We can divide the
numerator into the denominator and thereby expand H(z) into an infinite series from which it is
evident that h(n) is of infinite duration). Note that the corresponding deference equation is
The pole-zero system The general form, though, contains both poles and zeros and the system is
called a pole-zero system with N poles and M zeros,
b0 b1 z1 b 2z2 .......... b Mz M
H(z) = 1 2
a a z a z ......... a zN
0 1 2 N
Poles and/or zeros at z = 0 and z = are implied but are not counted explicitly. Due to the
presence of poles, the pole-zero system is an IIR system.
This is a power series (Laurent series). So by long division we obtain the power series expansion
of X(z) and then, by comparison with the power series definition given above, we can identity the
sequence x(n). In particular the coefficient of z–k is the sequence value x(k).
The method is useful in obtaining a quick look at the first few values of the sequence
x(n). This approach does not assure an analytical solution. The ROC will determine whether the
series has positive or negative exponents. For right-sided sequences the X(z) will be obtained
with primarily negative exponents, while left-sided sequences will have primarily positive
exponents. For an annular ROC, a Laurent expansion would give both positive- and negative-
time terms. This last possibility is illustrated in the example below by taking a little help from
partial fractions.
Solution (a) ROC is |z| > 2. We expect a right-sided sequence, with predominantly negative
exponents of z. For the long division arrange numerator and denominator as decreasing powers
Im z
ROC
Re z
1 2
of z and then divide; or as increasingly negative power of z i.e., z–1 and then divide.
Solution (b) The ROC is |z| < 1. We expect a left-sided sequence with predominantly positive
exponents of z. For the long division the polynomials are written in the order of increasing
powers of z (or decreasingly negative powers of z, i.e., z–1).
Im
ROC
Re
1 2
Thus X(z) = –(3/2)z – (5/4)z2 – (9/8)z3 – … = …– (9/8)z3 – (5/4)z2 – (3/2)z. By comparing with
the defining equation
(Omit) Solution (c) The ROC is 1 < |z| < 2. We expect a two-sided sequence with both positive
and negative exponents of z. Looking at the pole-zero configuration, the pole at z =1 implies a
right-sided sequence and the pole at z = 2 a left-sided sequence. Obviously just a single long
division cannot give both the left-sided and the right-sided sequences simultaneously. We shall
obtain the partial fraction expansion first and then proceed with the division to obtain the
sequences separately. These two sequences are then combined into one sequence to get the
solution. Note that we do this only to illustrate the method of long division. But once we use
partial fractions the utility of long division is nullified.
Im
ROC
Re
1 2
X (z) 2z 3 A B
= = +
z (z 1) (z 2) z 1 z 2
2z 3
A= = (2 . 1 – 3) / (1 – 2) = 1
z 2 z1
2z 3
B= = (2 . 2 – 3) / (2 – 1) = 1
z 1 z2
X (z) 1 1
+
z = z1 z2
z
X (z) = z +
z1 z2
z
For the term we have a right-sided sequence given by long division thus:
z1
1 + z –1 + z –2 + z –3
+…… ←Q(z)
D(z)→ z – 1 z ←N(z)
z–1
1
1 – z–1
z–1
z–1 – z–2
z–2
…
z
For the term we have a left sided sequence
z2
H(z) =
b z
r0
r r
a z k
k
k0
j
The frequency response is H (e ) or H(ω) = H (z) z ej . Thus
M M M
j jH ( ) r 0
r b
r 0
r cos r j br sin r
r0
H (e ) = |H(ω)| e = N = N N
ae a cos k j a sin k
j k
k k k
k0 k0 k0
M M
b r cos r j br sin r
A jB
Nr 0 rN 0
= = C jD
a cos k j a sin k
k 0
k
k0
k
where
M M N N
A= b cos r ,
r0
r B= b sin r ,
r0
r C= a
k0
k cos k , D= a
k0
k sin k .
Theorem The frequency response H (e j ) for a BIBO-stable system will always converge.
Accordingly every BIBO-stable system will have a frequency response and a describable steady-
state response to sinusoidal inputs. But, the converse of this statement is not true, that is, the fact
that H (e j ) exists does not imply that the system is stable.
Example 1.8.1 [The ideal low pass filter] For the H(ω) given in figure below find h(n), the unit
sample response.
|H(ω)| Periodic
1
ω
–π –ωc 0 ωc π 2π
<H(ω)
Periodic
Phase = 0
ω
–π –ωc 0 ωc π 2π
Solution The unit sample response is the inverse DTFT of H(ω)
c c
1 1 1 e jc n e jc n
H () e j n
d 1 e j n
h(n) =
2
=
2
1e jn
d = 2 jn
=
n j2
c c
sin c n
= , for all n
n
It is seen that h(n) ≠ 0 for negative n so that the ideal low pass filter is noncausal. Moreover,
although h(n) tails off as n goes from 0 to ∞ and from 0 to –∞, it can be shown that h(n) is
n
not finite. This means that the ideal low pass filter is not BIBO-stable either.
sin
|D(ω)| = cos 52 (sin ) 2 and D()= tan1
cos 5
N () cos 4 2 (sin ) 2
|H(ω)| = =
D() cos 52 (sin ) 2
sin
H () = N () – D() = tan1 sin – tan1
cos 4 cos 5
The frequency response can be plotted. Note that |H(ω)| is an even function and H () is an
odd function of ω.
Using MATLAB:
j j j
H(ω) = e 4 = 1 4e b(1) b(2)e b(3)e j 2 ...
=
e j 5 1 5e j a(1) a (2)e j a(3)e j 2 ...
Here the vectors b and a specify, respectively, the numerator and denominator coefficients. In
our example b(1) = 1, b(2) = 4, a(1) = 1, and a(2) = –5. The MATLAB segment and the
corresponding plots follow. Note that the plot goes from –2 to 2. Compare with the solution
obtained in Unit I using a different function.
1.5
Magnitude
0.5
-8 -6 -4 -2 0 2 4 6 8
Frequency
4
Phase - Radians
-2
-4
-8 -6 -4 -2 0 2 4 6 8
Frequency
Example 1.8.3 Assume H(z) = 12z 1 is a causal system. Find the difference equation and
2
6z 2 z 1
the frequency response.
Solution Arrange H(z) in terms of negative powers of z
Y (z) z 2 (12 z 2 ) 2
H(z) = = (12 z )
=
X (z) z2 (6 z1 z2 ) (6 z 1 z 2 )
Cross multiplying
Y(z) (6 z1 z2 ) = X(z) (12 z2 )
6Y (z) z1Y (z) z2Y (z) = 12X (z) z2 X (z)
Taking the inverse z-transform
6y(n) y(n 1) y(n 2) = 12x(n) x(n 2)
1 1 1
y(n) = y(n–1) + y(n–2) + 2x(n) – x(n–2)
6 6 6
The poles of H(z) are located at
(1) (1)2 4 (6) (1) 1 1 24 1 5
z1, z2 = = = = 0.5 and –1/3
2 (6) 12 12
and are inside the unit circle. This being a causal system, the ROC is |z| > ½ and contains the
unit circle. The system is stable, and the frequency response is meaningful. It is given by
= 12z 1
2 12(e j )2 1 N ()
H(ω) = H (z) j = =
ze
6z 2 z 1 z e j
6(e j )2 e j 1 D()
where
N(ω) = 12(e j )2 1 = 12e j 2 1= 12cos 2 j12sin 2 1
12sin 2
j tan1 12cos 21
= 12 cos 2 1 2
(12sin 2 ) 2 e
D(ω) = 6(e j )2 e j 1 = 6e j 2 e j 1
= 6cos 2 j6sin 2 cos j sin 1
6sin 2sin
j tan 1 6cos2 cos 1
6 cos 2 cos 1
= (6sin 2 sin ) 2 e
2
The magnitude response is given by
(12 cos 2 1)2 (12 sin 2)2
|H(ω)| =
(6 cos 2 cos 1)2 (6 sin 2 sin )2
The phase response is given by
12 sin 2 6 sin 2 sin
H () = tan 1 tan 1
12 cos 2 1 6 cos 2 cos 1
Using MATLAB:
2 2
H(z) = 12z 1 = 12 z
6z 2 z 1 6 z 1 z 2
12 e j 2 b(1) b(2)e j b(3)e j 2 ...
H(ω) = =
j
6e e j 2 a(1) a (2)e j a(3)e j 2 ...
Here the vectors b and a specify, respectively, the numerator and denominator coefficients. In
our example b(1) = 12, b(2) = 0, b(3) = –1, a(1) = 6, a(2) = –1 and a(3) = –1. The MATLAB
segment and the corresponding plots follow. Note that the plot goes from – to .
Magnitude 2.5
1.5
-4 -3 -2 -1 0 1 2 3 4
Frequency (Rad)
0.4
Phase - Radians
0.2
-0.2
-0.4
-4 -3 -2 -1 0 1 2 3 4
Frequency (Rad)
Im
Unit circle ROC
|z| > 1.62
Re
–0.62 1.62
The pole locations are shown here. For the system to be causal the ROC is the exterior of a circle
with radius = 1.62. In this case ROC does not include the unit circle. (Equivalently, all the poles
do not lie within the unit circle). Hence the system is not stable.
(b) Taking the z-transform on both sides of y(n) + (1/4) y(n–1) = x(n) – x(n–1) we get
1 z z 1
H(z) = Y (z) = 1=
X (z) 1 (1/ 4)z z 0.25
There is a single zero at z = 1 and a single pole at z = –0.25 which is inside the unit circle – hence
stable. The frequency response is given by
e j 1
H(ω) = H (z) z e j =
z 1
= j = N ()
z 0.25 z e j e 0.25 D()
where
sin
N(ω) = e j 1 = cos j sin 1 = j tan1 cos 1
cos 12 sin 2 e
Magnitude
2
0
-4 -3 -2 -1 0 1 2 3 4
Frequency (Rad)
2
Phase - Radians
-1
-2
-4 -3 -2 -1 0 1 2 3 4
Frequency (Rad)
y(n) = – ak y(n k) +
k 1
b x(n r)
r 0
r
with (non-zero) initial conditions we need N initial conditions on the output y(n) and M initial
conditions on the input x(n). Usually the input is applied suddenly (i.e., it is stepped into the
system) at n = 0, so that no initial conditions are needed for it, that is, x(n) = 0 for n < 0. The
output y(n), however, in general, will have non-zero initial conditions for n = –1 to –N.
We are solving for y(n) for n ≥ 0, so that Y(z) = ʓ{y(n)} is the one-sided z-transform. The
difference equation contains other terms like y(n–1), y(n–2), etc. which are delayed versions of
y(n). Suppose N = 3, then we shall have y(n–1), y(n–2), and y(n–3) to deal with. The transform of
y(n–1) is handled as follows. First, for the sequence y(n) as shown below we define
Y+(z) = ʓ{y(n), n ≥ 0} = A Bz 1 Cz2 ...
We shall refer to this loosely as just Y(z) when there is no possibility of confusion.
y(n)
y(–2)
A
y(–1) C
y(–3)
B
n
–3 –2 –1 0 1 2
We then obtain y(n–1) by delaying the sequence by one unit, shown below.
y(n–1)
A
C
y(–1)
B
n
–2 –1 0 1 2 3
z–1Y+(z)
In a similar fashion
1 2 3 4
ʓ{y(n–2), n ≥ 0} = y(2)z y(1) z Az Bz Cz ...
0
z–2Y+(z)
Given the sequence x(n), we delay it by k units, and then truncate it to the left of n = 0 to get x(n–
k) u(n). We want find the z-transform of x(n–k) u(n).
If we let n–k = r, then n = r+k, and the summation limits n = 0 to ∞ become r = –k to ∞. Then
r k
1 1
= z k x(r) z r x(r) z r = z k X (z) x(r) z r
r0 r k r k
X+(z) IC
= zk X (z) x(k) zk x(k 1) zk 1 ... x(1) z1
= zk X (z) x(k) x(k 1) z1 ... x(1) z(k 1)
ʓ{x(n–k) u(n)} = zk X (z) x(k) x(k 1) z1 ... x(1) z(k 1)
The above result is used to solve linear constant coefficient difference equations with
inputs that are stepped into a system. Suppose we want the solution of
N M
a y(n k) = b x(n r) ,
k 0
k
r0
r n≥0
where we have used Z to mean ʓ the z-transformation operation. The left hand side is
(Note that in terms of the derivation earlier all of the Y(z)’s are Y+(z)’s, i.e. , one-sided
transforms). All the Y(z) terms can be grouped together under a summation, and all the remaining
terms, due to the initial conditions {y(i), i = –1, –2, …, –N}, can be grouped together so that the
above can be written as
N
LHS = a
k 0
k
z kY (z) + g{z–1, y(–1), y(–2), …, y(–N)}
ak z Y (z) + g{…} = b z
k r
r
X (z) + h{…}
k 0 r 0
k0 r0
M
b z
r 0
r
r
h{...} g{...}
Y(z) = X(z) N
k
+
N ak z k
k
k
0 a z k0
For an input sequence x(n) that is stepped into a system, specified in words like x(n) = 0
for n < 0, the initial conditions are clearly zero and do not matter. But for an output sequence
y(n) where the initial conditions y(–1), y(–2) are explicitly given to be non-zero we need to use
the above derived “z-transform for delayed truncated sequence”. In particular we have
ʓ{y(n)} = Y(z)
ʓ{y(n–1)} = z 1 Y (z) y(1) z1
ʓ{y(n–2)} = z2 Y (z) y(2) z y(1) z
2 1
B=
2z 2
(9 / 4)z (1/ 2)
= 2/3
z (1/ 4)z (1/ 2) z 1
C=
2z (9 / 4)z (1/ 2)
2
=1
z (1/ 4)(z 1) z 1/ 2
Y (z) (1/ 3) (2 / 3) 1
= + +
z z (1/ 4) z 1 z (1/ 2)
1 z
Y(z) = z 2 z
+ + z (1/ 2)
3 z (1/ 4) 3 z 1
n
1 1 2 n 1 n
y(n) = 1 u(n)
3 4 3 2
The iterative solution for this problem was obtained in Unit I. The time-domain solution
was covered in HW (Extra). The solution is repeated below
y(n) = 2, 5 , 15 , 51 ,...
4 16 64
1
Y(z) 1 0.5 z 0.25 z 2
= 0.25 0.25z1
(0.25)z z 1
Y(z) = 2
z 0.5z 0.25
Y (z) (0.25)z 1
= 2
z z 0.5z 0.25
The denominator on the right hand side has roots at
0.5 (0.5)2 4(1)(0.25)
z1 , z2 = = 1 5 = 0.309 and –0.809
2 4
Y (z) (0.25)z 1 A B
= = +
z (z 0.309)(z 0.809) z 0.309 z 0.809
(0.25)z 1
A= = 0.155
(z 0.809)
z 0.309
(0.25)z 1
B= = – 0.405
(z 0.309) z 0.809
0.405z
Y(z) = 0.155z –
z 0.309 z 0.809
y(n) = 0.155 (0.309)n – 0.405 (0.809)n , n≥0
The first few values of the sequence are y(n) = 0.25, 0.376, 0.25, 0.219,... and should be
compared with the iterative solution.
In the context of MATLAB, we may use filter(b, a, x) to generate the sequence y(n). The
coefficients of y(.) and x(.) are numbered slightly differently as below:
Input Sequence
1
0.5
xn
-0.5
-1
0 5 10 15 20 25
n
Output Sequence
0.4
0.2
yn
-0.2
-0.4
0 5 10 15 20 25
n
Example 1.9.3 Find the response sequence for the filter defined by
y(n) – 7 y(n–1) + 126 y(n–2) = x(n)
Assume the system is initially relaxed. Obtain the system function and plot its poles and zeros.
Solution The phrase “initially relaxed” means that the initial conditions are zero, that is, y(n) = 0
for n < 0 and x(n) = 0 for n < 0. The question doesn’t specify what the input x(n) is, so assume
δ(n). (What will the output be if both the input and the initial conditions are zero?)
= Y1(z) = Y2(z)
B* = e j0
2 e j0 a
So
Y(z) = Y1(z) + Y2(z) = Y1(z) + Y2 (z) z
z *
a y(1) z Az Bz B z
= + + +
za za z e j0 z e j0
Taking the inverse z-transform we get
y(n) = a y(–1) a n u(n) + A a n u(n) + B e j0 u(n) + B * e j0 u(n) n
n
= y2(n)
= y1(n)
y(n) = [a y(–1) + A] a n u(n) + B e j0 u(n) + B * e j0 u(n)
n
n
1
2 Re Bej0 n = 2 Re H (z) z e j0 e j0 n = Re H (z) z e j0 j0 n
2
e
Since H (z) z e j0 = H ( j0 ) = H ( j0 ) e jH ( j0 ) we can write
2 Re Be j0 n = Re H ( j ) e j0 n = Re H ( j ) e jH ( j0 )e j0 n
0 0
= ReH ( j )
e j 0 n H ( j0 )
0
= H ( j0 ) cos 0 n H ( j0
Thus y(n) becomes
y(n) = [a y(–1) + A] anu(n) + H ( j0 ) cos 0 n H ( j0 u(n)
Transient response Steady-state response
Since |a| < 1 the transient term will eventually go to zero as n → ∞. Even if the initial condition
is zero, y(–1) = 0, there is still a transient response Aanu(n) which eventually dies down.
If there is a nonzero initial condition, y(–1), but the input x(n) = 0, the solution becomes
y(n) = y1(n) = a y(–1) anu(n) which also dies down as n → ∞.
Direct Form realization of IIR filters An important class of linear shift invariant systems can
be characterized by the following rational system function (where X(z) is the input, Y(z) the
output and we have taken a0 = 1 in comparison with the earlier representation):
M
b z
k
Y (z) 1 M 1 M
= b0 b1 z .......... bM 1 z
k
H(z) = bM z k0
=
1 a1 z 1 .......... a N 1 z N 1 aN z N
N
1 ak z
X (z) k
k1
By cross multiplying and taking the inverse z-transform we get the difference equation
N M
To construct a filter structure we shall need three types of block diagram elements: a delay
element, a multiplier and an adder, illustrated below:
a1
y(n) y(n–1) y(n–1) a1 y(n–1) x(n) y(n)= x(n)+ a1y(n–1)
z –1
Y(z) z–1Y(z) z–1Y(z) a1 z–1Y(z) X(z) Y(z)= X(z)+a1z–1Y(z)
a1 y(n–1)
a1 z–1Y(z)
We can construct a realization of the filter called the Direct Form I by starting with y(n) and
generating all the delayed versions y(n–1), y(n–2), …, y(n–N); similarly starting with x(n) and
generating all the delayed versions x(n–1), x(n–2), …, x(n–M). We then multiply the above terms
by the respective coefficients and add them up. This is shown below (next page).
This is an Nth order system N being the order of the difference equation. There is no
restriction as to whether M should be less than or greater than or equal to N. The total number of
delay elements = (N+M). It is not in canonic form because it uses more than the minimum
possible number of delay elements. It is called “Direct Form” because the multipliers are the
actual filter coefficients {a1, a2, …, aN, b0, b1, b2, …, bM}.
The difference equation of this realization (or structure) continues to be
(M+1) multiplications
and will be referred to as the Direct Form I difference equation. The total number of
multiplications can be counted and is seen to be (N+M+1). We can also count and see that there
are (N+M) additions. Finally, to calculate the value y(n) we need to store N past values of y(.),
and M past values of x(.), that is, a total of (N+M) storage locations (storage for the present value
of x(.) is not counted).
Direct Form I
Pick-off
point
Multiplier Pick-off
b0 Adder
point y(n)
x(n) b0x(n)
Delay
z –1 z –1
element
b1 –a1
x(n–1) y(n–1)
b1x(n–1) –a1y(n–1)
z–1 z–1
b2 –a2
x(n–2) y(n–2)
Rearrangement of Direct Form I The above diagram of Direct Form I, or the corresponding
expression for H(z), is sometimes rearranged as below. This shows visually that the transfer
function H(z) is arranged as a cascade of an all-zero system, H2(z), followed by an all-pole
system, H1(z):
Y (z) M
H(z) = = b z
k
1 = H2(z) H 1(z)
X (z) k 0 k N k
ak z
1
k 1
H2(z) H1(z)
W (z) M k
The all-zero system is H2(z) = = bk z from which, by cross-multiplying and
X (z) k 0
taking the inverse z-transform, we get the difference equation below:
W(z) = H2(z) X(z) = X(z)
M
b z k
k
k 0
w(n) = b0 x(n) + b1 x(n–1) + … + bM x(n–M)
X(z) W(z)
H2(z)
Y (z) N1
from which, by cross-multiplying
The all-pole system is H1(z) = W (z) =
1 ak z
k
k 1
and taking the inverse z-transform, we get the difference equation as below:
1
Y(z) = H1(z) W(z) = W(z)
N
1 ak z
k
k 1
y(n) = w(n) – a1 y(n–1) – a2 y(n–2) –… – aN y(n–N)
W(z) Y(z)
H1(z)
Even though it seems that there are two equations, one for w(n) and another for y(n), there is, in
effect, only one since w(n) in the second equation is simply a short hand notation for the first
equation and can be eliminated from the equation for y(n).
Overall, the Direct Form I has the following alternative appearance:
b0
x(n) w(n) y(n)
z–1 z–1
b1 –a1
z–1
–a2
bM–1
Derivation of Direct Form II The transfer function H(z) can be written as the product of the
two transfer functions H1(z) and H2 (z) as follows where we have reversed the sequence of the
two blocks:
Y (z) M
b z k
k = H1(z) H2(z)
1
H(z) = =
N
1 ak z k 0
X (z) k
k 1
H1(z) H2(z)
p(n) b0
x(n) p(n) y(n )
z–1 z–1
–a1 b1
z–1 z–1
–a2
–aN–1 bM–1
z–1
–aN bM
z–1
–a1 b1
z–1
–a2
–aN–1
bM
z–1
–aN
(Aside) This diagram of the filter structure is properly called a block diagram. There is another
representation called the signal flow graph. See below for signal flow graphs and transposed
structures.
In the above diagram each column of adders on each side can be replaced by a single adder
resulting in the more familiar form shown below. There are now only two adders.
Direct Form II
z–1
–a1 b1
p(n–1)
z–1
–a2
z–1
bM
z–1
The number of delay elements = max {N, M} – this is the minimum possible, hence called
a canonic form. The multipliers are the actual coefficients from the difference equation. Hence
this is also a direct form.
The numbers of multipliers and adders are also the minimum possible, but this does not
mean that it is the best realization from other considerations like immunity to round off and
quantization errors.
The difference equations are:
p(n) = x(n) –a1 p(n–1) –a2 p(n–2) –… –aN p(n–N) , and
y(n) = b0 p(n) + b1 p(n–1) + … + bM p(n–M)
The above equations show that in order to generate y(n) we need the present value of x(.)
and N (or M or whichever is larger) past values of p(.). This requires N storage locations not
counting the present value of x(.). We also see that the number of multiplications = N+M+1, and
number of additions = N+M.
Comparing the difference equations of Direct Forms I and II:
To compute y(n) in DF I we need the past N outputs, the present input, and the
past M inputs.
To compute y(n) in DF II we need the N (or M) values of p(n–k) for k = 1,2, …, N,
and the present input.
This illustrates the concept of the state of a system.
Definition The state of a system is the minimum information required that along with the input
allows the determination of the output.
From the above discussion the N (or M) values p(n–k), k = 1, 2, …, N, make up the state of the
system.
–a1 b1
z–1
–a2
–aN–1
bM
z–1
–aN
The signal flow graph corresponding to the above structure is shown below. With regard
to the “a” and “b” coefficients we have arbitrarily taken M = N, but M and N are independent of
each other. In this figure the bottom-most right and left nodes are unnecessary.
z–1
–a1 b1
z–1
–a2 b2
–aN–1 bN–1
z–1
–aN bN
Transposition (Flow graph reversal) leaves the overall system function between input and
output unchanged and leads to a set of transposed system structures that provide some useful
alternatives.
Transposition of a flow graph is accomplished by reversing the directions of all branches
while keeping the branch transmittances as they were and reversing the roles of the input and
output so that source nodes become sink nodes and vice versa. Clearly, if a signal flow graph
configuration is transposed, the number of delay branches and the number of coefficients remain
the same. Thus a canonic structure remains canonic in the process of transposition.
The result of applying the transposition theorem to the signal flow graph of the direct
form II structure (and reorienting the diagram so that the input and output still appear on the left
and right sides, respectively) is shown below. This will be referred to as the “direct form II
transposed”.
x(n) b0 y(n)
z–1
b1 –a1
z–1
b2 –a2
bN–1
z–1
bN –aN
Comparison of the direct form II with its transposed version shows that
The direct form II structure implements the poles first and then the zeros
The transposed direct form II structure implements the zeros first and then the
poles
These differences can become important in the presence of quantization in finite precision digital
implementations or in the presence of noise in discrete-time analog implementations.
When the transposition theorem is applied to cascade or parallel structures, the individual
second-order systems are replaced by transposed structures.
Example 1.11.1 Develop a canonic direct form realization of the transfer function
H(z) = 6z5 8z3 4
2z5 6z 4 10z3 8z
Solution Write numerator and denominator as polynomials in negative powers of z with the
leading term (a0) in the denominator equal to 1
5
H(z) = z 5 (6 8z 2 4z ) = (6 8z 2 4z 5 )
z 5 (2 6z1 10z2 8z 4 ) (2 6z 1 10z 2 8z 4 )
2 5 2 5
(6 8z 4z ) 3 4z 2z
= 1 2 4 =
2 (1 3z 5z 4z ) 1 3z 1 5z 2 4z 4
Making the following comparison with the standard notation
b b z 1 b z 2 b z 3 b z 4 b z 5 3 4z 2 2z 5
H(z) = 0 1 2 3 4 5
=
1 a1z 1 a2 z 2 a3 z 3 a4 z 4 1 3z 1 5z 2 4z 4
we identify the following parameters:
b0 = 3, b1 = 0, b2 = 4, b3 = 0, b4 = 0, b5 = –2
a1 = 3, a2 = 5, a3 = 0, a4 = 4
p(n–1)
–3
(–
a1) z–1
–5 (–a2) 4 (b2)
z–1
p(n–3)
z–1
–4 (–a4)
z–1
–2 (b5)
p(n–5)
1 (–a1) –2 (b1)
z–1
–9/16 –1 (b2)
z–1
1/16 2 (b3)
z–1
p(n–4)
–1/32
p(n) = ?
y(n) = ?
Biquadratic section When M = N = 2 we have the biquadratic section, an important building
block. Thus H(z) is a ratio of two quadratics in z–1 given by
b b z 1 b z 2
H(z) = 10 a1z 1 a2 z 2
1 2
The corresponding DF II structure is shown below with the difference equations.
Biquadratic section – DF II
z–1
b1
–a1
z–1
b2
p(n–2)
–a2
Alternative Biquadratic
x(n) b0 y(n)
z–1
b1
–a1
z–1
b2
–a2
As an exercise label the signal out of the left adder as w(n) and write down the difference
equations.
Cascade realization of IIR filters Many different realizations exist depending on how we
choose to write and rearrange the given transfer function. Two very important ways of
decomposing the transfer function are the cascade and parallel decompositions.
In the cascade realization H(z) is broken up into a product of transfer functions H1, H2,
…, Hk, each a rational expression in z–1 as follows:
Y (z) = H(z) = H (z) H (z) … H (z) H (z)
k k–1 2 1
X (z)
so that Y(z) can be written as
H(z)
Although H(z) could be broken up in many different ways, the most common cascade
realization is to require each of the k product H’s to be a biquadratic section. In many cases the
design procedure yields a product of biquadratic expressions so no further work is necessary to
put H(z) in the required form. The product terms Hi(z) could take various forms, depending on
the actual problem. Some possible b0 forms are
, H (z) = b0 b1 z1
Hi(z) = i
1 a 1z 1 a 2 z 2 1 a1 z 1 a 2 z 2
b b z 1 b z 2
Hi(z) = b0 + b1z–1 + b2z–2, Hi(z) = 0 1 2
1 a1z 1
b b z 1 b z 2
Hi(z) = 10 a 1z 1 a2z 2 (Biquadratic)
1 2
b b z 1
0 1
Hi(z) = (Bilinear)
1 a1z 1
Each of the Hi(z) could then be realized using either the direct form I or II.
Different structures are obtained by changing the ordering of the sections and by
changing the pole-zero pairings. In practice due to the finite word-length effects, each such
cascade realization behaves differently from the others.
Example 1.11.3 Develop two different cascade canonic realizations of the following causal IIR
transfer function
z(0.3z 0.5)(2z 3.1)
H(z) = 2
(z 2.1z 3)(z 0.67)
Solution Write in terms of negative powers of z:
1
H(z) = z z (0.3 0.5z )(2 3.1z ) =
2 1 (0.3 0.5z 1 )(2 3.1z 1 )
z 3 (1 2.1z1 3z 2 )(1 0.67z1 ) (1 2.1z1 3z 2 )(1 0.67z1 )
Two (of several) different cascade arrangements, based on how the factors are paired, are shown
below in block diagram form. Note that the intermediate signal y1(n) is different from the
intermediate signal y3(n).
Cascade – A
Cascade – B
Cascade A is shown below using the direct form II for each block separately:
x(n) 0.3 y1(n)
p1(n)
z–1
–0.5
–2.1
z–1
3 p1(n–2)
z–1
3.1
–0.67
Cascade B is shown below using the direct form II for each block separately:
x(n) 2 y3(n)
p3(n)
z–1
3.1
–2.1
z–1
3 p3(n–2)
y3(n) 0.3 y4(n) = y(n)
p4(n)
z–1
–0.5
–0.67
A(z) B(z)
Note in this example that if H(z) = , then depending on the pole-zero pairings and the
C(z) D(z)
sequence order of the blocks in the cascade we can have 4 different implementations (structures).
These are equivalent from input to output though not at the intermediate point between the
blocks. Moreover the quadratic (z2 + 2.1z – 3) has real roots and so can be split into two factors
each of which can be combined with the other factor (z + 0.67) in the denominator. This results
in more than the 4 structures shown here.
Parallel realization of IIR filters The transfer function H(z) is written as a sum of transfer
functions H1(z), H2(z), …, Hk(z) obtained by partial fraction expansion:
Y (z) = H(z) = H (z) + H (z) + … + H (z) + H (z)
1 2 k–1 k
X (z)
Thus
Y(z) = H(z) X(z) = [H1(z) + H2(z) + … + Hk–1(z) + Hk(z)] X(z)
= H1(z) X(z)+ H2(z) X(z)+ … + Hk–1(z) X(z)+ Hk(z) X(z)
and is shown in block diagram fashion below. Note that the outputs y1(n), y2(n), …, yk(n) are
independent of each other; they are not coupled as in the case of the cascade structure.
Based on whether H(z)/z or H(z) is the starting point for partial fractions we have parallel
forms I and II (S. K. Mitra). Both of these methods are illustrated below.
H1(z)
y1(n)
H2(z)
y2(n)
x(n)
Σ y(n)
X(z)
Y(z)
Hk(z)
yk(n)
H(z)
Parallel Form I (This corresponds to expanding H(z)/z instead of H(z) into partial fractions).
This structure arises when the Hi(z) are all selected to be of the form
b 0 b1z 1 b0z 2 b1 z z(b0 z b1 )
Hi(z) = = =
1 a1z 1 a2 z 2 z 2 a1 z a2 z 2 a1 z a2
where the quadratic terms are used for each pair of complex conjugate poles so that the
coefficients of the corresponding Hi(z) will be real. Each Hi(z) is then realized as either a DF I or
DF II. Special cases of Hi(z) are
b0
Hi (z) = b0, Hi(z) = b0 z , H (z) = b z–1
1 = i 1
1 a 1z z a1
Parallel Form II (This corresponds to expanding H(z) directly into partial fractions). This
structure arises when the Hi(z) are all selected to be of the form
b1 z 1 b2 z 2 b1z b2
Hi(z) = =
1 a1z 1 a2 z 2 z 2 a1 z a2
8z3 4z 2 11z 2 2
z (1/ 4)z 2 z (1/ 2)z 0 (1/ 4)(1/ 2)
A= = = 16
16
y1(n)
8
x(n) p2(n) y2(n) y(n)
z–1
0.25
–16
p3(n)
y3(n)
–1
z
20
z–1
–0.5
HW Identify other signals on the diagram as needed and write down the implementation
equations in full.
Long Division
8 ←Quotient
Denominator→ z3 – 1.25z2 + 0.75z – 0.125 8z3 – 4z2 + 11z – 2 ←Numerator
8z3 – 10z2 + 6z – 1
6z2 + 5z – 1 ←Remainder
H(z) = 8 + 6z2 5z 1 =8+ 6z 2 5z 1
z3 1.25z2 0.75z 0.125 z (1/ 4)z 2 z (1/ 2)
The proper fraction part can now be expanded into partial fractions. Let
6z 2 5z 1 A B z C
z (1/ 4)z z (1/ 2) z (1/ 4) z z (1/ 2)
2
= + 2
6z 2 5z 1 ...
=…= =2
A= 2
z z (1/ 2)z 1/ 4 ...
To determine B and C
6z 2 5z 1 Az 2 z (1/ 2) (Bz C)z (1/ 4)
z (1/ 4)z 2 z (1/ 2) z (1/ 4)z 2 z (1/ 2)
=
2z 1 4z 1 8z 2
H(z) = 8 + + = H1(z) + H2(z) + H3(z)
1 0.25z 1 1 z 1 0.5z 2
8
y1(n)
z–1
0.25 2
y3(n)
–1
z
4
z–1
8
–0.5
HW Identify other signals on the diagram as needed and write down the implementation
equations in full.
Realization of FIR filters A causal FIR filter is characterized by its transfer function H(z) given
by
Y (z) = H(z) = M b z = b + b z–1 + … + b –M
z
r
r r 0 1 M
X (z) 0
Note that some use the notation below with M coefficients instead of M + 1
M 1
We see that the output y(n) is a weighted sum of the present and past input values; it does not
depend on past output values such as y(n–1), etc. The block diagram is shown below. It is also
called a tapped delay line or a transversal filter.
Mth Delay
x(n) x(n–M)
z–1 z–1 z–1 z–1
b0 b1 b2 b3 bM
y(n)
It can be seen that this is the same as the direct form I or II shown earlier for the IIR filter, except
that the coefficients a1 through aN are zero and a0 = 1; further the delay elements are arranged in
a horizontal line. As in earlier diagrammatic manipulation the multipliers can all feed into the
rightmost adder and the remaining adders removed.
Other simplifications are possible based on the symmetry of the coefficients {br}, as we
shall see in FIR filter design.
Cascade realization of FIR filters The simplest form occurs when the system function is
factored in terms of quadratic expressions in z–1 as follows:
b2i z 2
K
b
K
H(z) = Hi (z) =
1
0i b1i z
i 1 i 1
Selecting the quadratic terms to correspond to the complex conjugate pairs of zeros of H(z)
allows a realization in terms of real coefficients b0i, b1i and b2i. Each quadratic could then be
realized using the direct form (or alternative structures) as shown below.
z–1 y(n)
b21 b22 b2K
Parallel realization of FIR filters These are based on interpolation formulas by Lagrange,
Newton, or Hermite methods. In general, these realizations require more multiplications,
additions and delays than the others.
1 ak z
k
k 1
We shall write the subscript k on the coefficients a as an index within parentheses: thus ak
becomes a(k); further we shall also incorporate the order N of the filter as a subscript on the
coefficients a: thus for an Nth order filter we shall have the set of coefficients aN(k), with k = 1 to
N. With this notational refinement the system function goes through the following steps
1 1
H(z) = N = 1 a(1) z1 a(2) z2 .... a(N ) zN
1 a(k) z k
k 1
1 1 1
H(z) = = 1 2 N =
.... aN (N ) z
N
1 a N(k ) z
k 1 aN (1) z a N (2) z AN (z)
k 1
Note that we have also awarded a subscript to the system function H, that is, H(z) is written H1(z)
just to remind ourselves that we are only dealing with a first order system. The difference
equation can be written down from
1
H1(z) = Y (z) = 1
1 = 1
X (z)
1 a1 (k) z k
1 a 1 (1) z
k 1
This difference equation is implemented by the following structure (which can be visually
verified). Concerning the labeling of the diagram note that a1(1) is not a signal but a multiplier
that multiplies the signal coming out of the delay element and before it reaches the adder (we
have previously used a triangular symbol for the multiplier).
x(n) y(n)
–a1(1)
z–1
An embellished version of the above structure is shown below and is used as a building block in
the lattice structure. This being a first order filter the relationship between the direct form
coefficient a1(1) and the lattice coefficient K1 is obvious, that is, a1(1) = K1. The implementation
equations, in terms of the lattice coefficient, are
At this point the need for the additional symbols f(.) and g(.) and the equation for g1(n) is not
obvious, but they become more useful as we increase the order of the filter and the relationship
between the coefficients of the two structures becomes more involved.
a1(1) = K1
–a1(1) = –K1
z–1
g1(n) g0(n) = y(n)
Consider the second order (all-pole) filter (N = 2) whose transfer function is
1 = 1
H2(z) = Y (z) = 2
1
= 1 2
X (z) 1 a2 (1)z a2 (2)z
1 a2 (k ) z
k A2 (z)
k 1
The corresponding lattice structure is obtained by adding a second stage at the left end of the
previous first order structure:
x(n) = f2(n) f1(n) y(n) = f0(n)
a2(2) = K2 K1
z–1 z–1
g2(n) g1(n) g0(n) = y(n)
We can write an equation for y(n) in terms of the lattice coefficients K1 and K2 and the signal
values x(n), y(n–1) and y(n–2):
Comparing this equation with the direct form equation for y(n) given above we have the
relationship between the direct form and lattice coefficients
Note that we have thrown in a freebie in the form of a2(0) = 1 for future (actually it corresponds
to the leading term in the denominator polynomial, A2(z)).
Digital Signal Processing – 2
Contents:
Fourier analysis – Recapitulation
Discrete Fourier series
Properties of discrete Fourier series
The discrete Fourier transform (DFT)
Properties of DFT
Filtering through DFT/FFT
Picket-fence effect
Fourier analysis - Recapitulation
(1) The Fourier series (FS) of a continuous-time periodic signal, x(t), with fundamental period
T0, is given by the synthesis equation
x(t) = X
k
k e j 2 k F0 t
The Fourier coefficients, Xk, are given by the analysis equation
1 j 2 kF0 t
T0 T0
Xk = x(t) e dt
The fundamental frequency, F0 (Hz), and the period, T0 (seconds), are related by F0 = 1/T0.
(2) The Fourier transform (FT) of a continuous-time aperiodic signal, x(t), is given by the
analysis equation
x(t) e x(t) e
j 2 F t j t
X(F) = dt or X(Ω) = dt
Here Ω and F are analog frequencies, with Ω = 2πF. The inverse Fourier transform is given by
the synthesis equation
1
x(t) = X (F ) e j 2 F t
dF or x(t) =
2 X () e jt d
(3) The Fourier series (DTFS/DFS) for a discrete-time periodic signal (periodic sequence),
x(n), with fundamental period N is given by the synthesis equation
N 1
x(n) = Xk e
j 2 k n / N
, 0 n N–1
k0
x(n) e j 2 k n/ N , 0 k N–1
Xk = 1
N n0
This is called the discrete-time Fourier series (DTFS) or just discrete Fourier series (DFS) for
short. The sequence of coefficients, Xk, also is periodic with period N.
These two equations are derived below.
(Note that if the factor (1/N) is associated with x(n) rather than with Xk the two DFS
equations are identical to the two DFT equations which are derived below in their standard
form.)
(4) The Fourier transform (DTFT) of a finite energy discrete-time aperiodic signal
(aperiodic sequence), x(n), is given by the analysis equation (some write X(ejω) instead of X(ω))
X(ω) = x(n) e
n
j n
Certain convergence conditions apply to this analysis equation concerning the type of signal x(n).
We shall call this the discrete-time Fourier transform (DTFT). Physically X(ω) represents the
frequency content of the signal x(n). X(ω) is periodic with period 2π.
The inverse discrete-time Fourier transform is given by the synthesis equation
1
x(n) = X () e jn d
2 2
The basic difference between the Fourier transform of a continuous-time signal and the
Fourier transform of a discrete-time signal is this: For continuous time signals the Fourier
transform, and hence the spectrum of the signal, have a frequency range (–, ); in contrast, for
a discrete-time signal the frequency range of the DTFT is unique over the interval of (–π, π) or,
equivalently, (0, 2π).
Since X(ω) is a periodic function of the frequency variable ω, it has a Fourier series
expansion; in fact, the Fourier coefficients are the x(n) values.
x(n) = Xk e
j k 0 n
for all n
k
Here Xk are the Fourier coefficients and ω0 = 2π/N is the fundamental (digital) frequency (as Ω0
2
= 2π/T0 = 2πF0 is in the case of continuous-time Fourier series). With kω0 = ωk = k , the
N
above is also written
X
j k 2 n / N
k k e
k k
j k 2 n / N
The function e is periodic in k with a periodicity of N and there are only N distinct
functions in the set e j k 2 n / N corresponding to k = 0, 1, 2, ..., N–1. Thus the representation for
x(n) contains only N terms (as opposed to infinitely many terms in the continuous-time case)
x(n) = X
k N
k
e j k 2 n / N
The summation can be done over any N consecutive values of k, indicated by the summation
index k = <N>. For the most part, however, we shall consider the range 0 ≤ k ≤ N–1, and the
representation for x(n) is then written as
N 1
x(n) = Xk e
j k 2 n / N
for all n
k0
This equation is the discrete-time Fourier series (DTFS) or just discrete Fourier series (DFS)
of the periodic sequence x(n) with coefficients Xk.
The coefficientsN X k or X(k) are given by (we skip the algebra – S&S)
1
x(n) e j 2 k n/ N , 0 k N–1
Xk = 1
N n0
(B)
Note that the sequence of Fourier coefficients {Xk} is periodic with period = N. That is, Xk =
Xk+N. The coefficients can be interpreted to be a sequence of finite length, given by Eq. (B) for k
= 0, 1, 2, …, N–1 only and zero otherwise, or as a periodic sequence defined for all k by Eq. (B).
Clearly both of these interpretations are equivalent.
Because the Fourier series for discrete-time periodic signals is a finite sum defined
entirely by the values of the signal over one period, the series always converges. The Fourier
series provides an exact alternative representation of the time signal, and issues such as
convergence or the Gibbs phenomena do not arise.
The periodic sequence X(k) has a convenient interpretation as samples on the unit circle,
equally spaced in angle, of the z-transform of one period of x(n). Let x1(n) represent one period
of x(n). That is,
x (n) z z e j 2 k / N
n 1
Then X1(z) = = x (n) z n , and X(k) = X (z) . This then corresponds to
n n 0
sampling the z-transform X1(z) at N points equally spaced in angle around the unit circle, with the
first such sample occurring at z = 1. (Note that the periodic sequence x(n) cannot be represented
by its z-transform since there is no value of z for which the z-transform will converge. However,
x1(n) does have a z-transform.)
DFS { xp(n+m)} = x
n0
p
(n m)WNkn
Set n+m = λ so that n = λ–m and the limits n = 0 to N–1 become = m to N–1+m. Then the RHS
becomes
= N
1 m
k km
xp () WN WN
m
Since xp(λ) is periodic with period N the summation can be done over any interval of length N.
Thus
N 1 N
N 1 p N
x () W
p N N k
DFS { xp(n+m)} =
x
0
() W W k km
= W k m 0
= k m
WN Xp(k) QED
Example 2.3.2 Show that DFS { x* (n)} = X * (k).
p p
Solution We have
* *
N 1 N 1 * k n
DFS { x*p (n)} = x*p (n) W Nk n = x p (n)W N
n0
*
n0
x(t) = X
k
k
e j 2 k F0 t (1)
with the fundamental frequency F0 and the period T0 related by F0 (Hz) = 1/T0 (sec).
To obtain finite-sum approximations for the above two equations, consider the analog
periodic signal x(t) shown in Figure and its sampled version xs(nT). Using xs(nT), we can
approximate the integral for Xk by the sum
1 N 1
Xk = xs (nT )e j 2 k F0 nTT , k = 0, 1, …, N–1
T0 n 0
N 1
= 1 x(n) e j 2 k n / N , k = 0, 1, …, N–1
N n0
where we used the relation F0T = 1/N, and approximated dt (or t) by T, and have used the
shorthand notation x(n) = xs(nT). (This procedure is similar to that used in a typical introduction
to integral calculus).
A finite series approximation for x(t) is obtained by truncating the series for x(t) in
equation (1) to N terms and substituting t = nT and F0 = 1/TN. This will necessarily give the
discrete sequence x(n) instead of the continuous function x(t):
x(n) or xn = N
1
X k e j 2 k n / N , n = 0, 1, …, N–1
k0
x(t)
t
0 T0 2T0
x(t) xs(nT)
T0 = NT t
0 T 2T (N–1)T
N samples at n = 0, 1, …, N–1
Δt or dt = T = T0/N
The above two equations define the discrete Fourier transform (DFT) pair. A slight
adjustment of the (1/N) factor is needed so as to conform to standard usage. The adjustment
consists of moving the (1/N) factor from one equation to the other. Then the direct DFT of the
time series x0, x1, …, xN-1 is defined as
N 1
Xk = xn e
j 2 k n / N
, k = 0, 1, …, N–1 (3)
n0
It can be shown that substituting equation (3) into equation (4) produces an identity, so that the
two equations are indeed mutually inverse operations and therefore constitute a valid transform
pair.
(End of Omit)
The discrete Fourier transform as a discretized (sampled) version of the DTFT A finite-
duration sequence x(n) of length N (the length N may have been achieved by zero-padding a
sequence of shorter length) has a Fourier transform denoted X(ω) or X(ejω),
N 1
X(ω)
ω
0 2 /N 2
0 1 N–1 N
N samples of ↓(ω)
The correspondingN inverse
1
discrete Fourier transform (IDFT) is given by
x(n) = X (k) e j 2 k n / N , n = 0, 1, …, N–1
1
N k0
Example 2.4.1 Find the DFT of the unit sample x(n) = {1, 0, 0, 0}. (Aside. What is the DTFT of
x(n) = {1, 0, 0, 0}?)
x(n) = {1, 0, 0, 0}
n
0 1 2 3 4
N–1 N
Sequence
X(k) = x(n) e
n0
j k 2 n / N
, 0 k N–1
41
= x(n) e j k 2 n / 4 , 0k3
n0
3
= x(n) e j k 2 n / 4 , k = 0, 1, 2, 3
n0
x(n) e
n0
j k 2 n / 4
, k = 0, 1, 2, 3
3 3 3
k=0
X(0) = x(n) e j 0.2 n / 4
= x(n).1 = x(n)
n 0 n 0 n 0
The DFT is X(k) = {1, 1, 1, 1} and contains all (four) frequency components. In this example
X(k) is real-valued.
In MATLAB use fft(x) for the DFT. The magnitude and phase plots of X(k) and the
program segment follow.
0.5
0
0 0.5 1 1.5 2 2.5 3
k
0.5
Phase
-0.5
-1
0 0.5 1 1.5 2 2.5 3
k
Matrix formulation To facilitate computation the DFT equations may be arranged as a matrix-
vector multiplication. We define the twiddle factor WN = e j 2 / N , which for N = 4 becomes
W4 = e j 2 / 4 . The equations are rewritten using the twiddle factor
3 3
X(k) = x(n) e j k 2 n / 4
= x(n)W 4k n , k = 0, 1, 2, 3
n 0 n 0
X (0) 1 1 1 1 x(0)
1 2 3
1 W W W
X (2) =
X (1) 4 4 4
x(1)
1 W 2 W 4 W 6 x(2)
4 4 4
X (0) 1 1 1 1
1 1
j
X (1) 1 j 1 0 = 1
X (2) = 1 1 1 1 0 1
X (3) 1 j 1 j 0 1
Example 2.4.2 Find the DFT of the “dc” sequence x(n) = {1, 1, 1, 1}. (Aside. What is the DTFT
of x(n) = {1, 1, 1, 1}? Give 4 samples of X(ω) at intervals of 2π/4 starting at ω = 0.) (Compare
Proakis, 3rd Ed., Ex. 5.1.2)
x(n) = {1, 1, 1, 1}
n
0 1 2 3 4
N–1 N
Sequence
= x(n) e j k 2 n / 4 , k = 0, 1, 2, 3
n0
X(k) == x(n) e j k 2 n / 4 , k = 0, 1, 2, 3
n0
3 3 3
k=0
X(0) = x(n) e j 0 .2 n / 4
= x(n) . 1= x(n)
n 0 n 0 n 0
n 0 n 0 n 0 n 0
= 1 – j + (–j) + (–j) = 1 – j + j – j = 1 – j – 1 + j = 0
2 3 2 3
3 3
k=2
X(2) = x(n) e j 2 . 2 n / 4
= 1.(e j
)n = 1 – 1 + 1 – 1 = 0
n 0 n 0
3 3
k=3
X(3) = x(n) e j 3 . 2 n / 4 = 1.e j 3 n/2
= 1+ j – 1 – j = 0
n 0 n 0
The DFT is X(k) = {4, 0, 0, 0} and contains only the “dc” component and no other. Here again
X(k) is real-valued.
Example 2.4.3 Find the DFT of the sequence x(n) = {1, 0, 0, 1}
x(n) = {1, 0, 0, 1}
n
0 1 2 3 4
N–1 N
Sequence
Solution The number of samples is N = 4. The DFT is given by
N 1
X(k) = x(n) e
n0
j k 2 n / N
, 0 k N–1
3
= x(n) e j k 2 n / 4 , k = 0, 1, 2, 3
n0
X(k) = x(n) e j k 2 n / 4 , k = 0, 1, 2, 3
n0
3 3 3
k=0
X(0) = x(n) e j 0. 2 n / 4
= x(n).1= x(n)
n 0 n 0 n0
n 0 n 0 n 0 n0
= 1 . 1 + 0 + 0 + 1 . (–j) = 1 + j = 3
2e /4=
j
2 / 4
3 3
k=2
X(2) = x(n) e j 2. 2 n / 4 = x(n) e j n = x(0) e–j 0 + x(3) e–jπ3
n 0 n0
= 1 . 1 + 1 . (–1) = 0
3 3
k=3
X(3) = x(n) e j 3. 2 n / 4
= x(n) e j 3 n / 2 = x(0) e–j 0 + x(3) e–j 3π3 / 2
n 0 n0
= 1 . 1 + 1 . (–j) = 1 – j = 2 e–j / 4 = 2 / 4
The DFT is X(k) = {2, 2e j / 4 , 0, 2e j / 4 }. In general X(k) is complex-valued and has a
magnitude and a phase. See figure.
In MATLAB use fft(x) for the DFT and ifft(X) for the IDFT. The magnitude and phase
plots and the program segment follow.
1.5
Magnitude
0.5
0
0 0.5 1 1.5 2 2.5 3
k
0.5
Phase
-0.5
-1
0 0.5 1 1.5 2 2.5 3
k
|X(k)| DFT of x(n) = {1, 0, 0, 1}
2
2 2
k
0 1 2 3 4
N–1 N
X (k)
π/4 π/4
3
k
0 1 2 4
–π/4 –π/4 N
x(n)
1 1
T = 125 μsec
0 1 2 3 4=N n
The terms introduced in this example and their interrelationships are summarized below:
|X(k)|
One complete period = Fs = 8 kHz
2 F0 = 2 kHz
2 2
0 1 2 3 4=N k
0 π 2π Digital Frequency,
ω = ΩT, rad/sample
Xk
Undefined
π/4
3
0 1 2 4=N k
–π/4
Example 2.4.4 Find the inverse discrete Fourier transform of X(k) = {3, (2+j), 1, (2–j)}.
Solution The number of samples
N 1
is N = 4. The IDFT is given by the synthesis equation
1
x(n) = X (k) e j 2 k n / N , n = 0, 1, … , N–1
N k0
3
= 4 X (k) e j 2 k n / 4 ,
1
k0
3
= X (k) e j k n / 2 ,
1
0n3
4 k0
The calculations for {x(n), n = 0 to 3} are shown in table below.
3
x(n) = 1
4 k X (k) e j k n / 2
0
n=0 1 3
1 3
x(0) = X (k) e
4 k 0
= X (k )
j k 0 / 2
4 k 0
= (1/4)3 {X(0) + X(1) + X(2) + 3X(3)} = (1/4) {3 + 2+j + 31 + 2–j} = 2
n=1
x(1) = (1/4) X (k) e
k 0
jk 1 /2
= (1/4) X (k) e
k 0
j /2 k
= (1/4) X (k) j
k0
k
0 1 2 3
= (1/4) {X(0) (j) + X(1) (j) + X(2) (j) + X(3) (j) }
= (1/4) {3 . 1 + (2+j) . j + 1 . (–1) + (2–j) . (–j)} = 0
3 3 3
n=2
x(2) = (1/4) X (k) e
k 0
jk 2 /2
= (1/4) X (k) e
k 0
jk
= (1/4) X (k) 1
k0
k
1.5
Magnitude
1
0.5
0
0 0.5 1 1.5 2 2.5 3
n
0.5
Phase
-0.5
-1
0 0.5 1 1.5 2 2.5 3
n
Matrix formulation Here again to facilitate computation the IDFT equations may be arranged
as a matrix-vector multiplication.
x(n) = 1 X (k) e j k 2 n / 4 =
1 3
X (k) W4* ,
3
4 n
kn
n = 0, 1, 2, 3
4 n0 0
1
W W W XX (1)
x(0) 1 1 (0) 1
x(1) 1 1
* 3
= 4*
1
4*
2
W W W
4
* 6
x(2) 4 1 * *
X (2)
2
4
X (3)
4
* 3 *4 6 *4 9
x(3)
1 W4 W4 W4
This last form is perhaps the most convenient to perform the actual computations by plugging in
the twiddle factors W4 * and the values X(.). The above matrix form then can be written,
m
1 1 1
W W W 32 j
x(0) 1
x(1) 1 1
= * 3
4*
1
4*
2
W W
4
x(2) 4 1 * *
W 1
* 6
2
4
*49 2 j
4
* 3 *4 6
x(3)
1 W4 W4 W4
www.jntuworld.com
Example 2.4.5 [N not an integral power of 2] Using MATLAB find the 5-point DFT of
x(n) = {1, 0, 0, 0, 0}
Solution
0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4
k
0.5
Phase
-0.5
-1
0 0.5 1 1.5 2 2.5 3 3.5 4
k
Example 2.4.6 [N not an integral power of 2] Using MATLAB find the 6-point IDFT of
X(k) = {6, 0, 0, 0, 0, 0}
Solution
0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
n
0.5
Phase
-0.5
-1
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
n
Example 2.4.7 Consider a sequence x(n) = {2, –1, 1, 1} and the sampling time T =
0.5 sec. Compute its DFT and compare it with its DTFT.
Solution The record length of the sequence is T0 = 4T = 2 sec.
The DFT is a sequence of 4 values given by
3
X(k) = x(n) e j k 2 n / 4 , k = 0, 1, 2, 3
n0
The periodicity of X(k) is 4. The frequency resolution of the DFT is 1/T0 = 0.5 Hz.
The DTFT, X(ω), is a continuous function of ω
3
X(ω) = x(n) e
n
j n
= x(n) e
n0
j n
= 2 e j 0 – 1 e j +1 e j 2 +1 e j3
j j 2
= 2– e +e + e j3
The periodicity of X(ω), in terms of ω, is 2. In terms of the Hertz frequency the periodicity is
the sampling frequency = Fs = 1/T = 2 Hz.
The DFT is a sampled version of the DTFT, sampled at 4 points along the frequency axis
spaced 0.5 Hz apart.
You should evaluate completely both X(k) (a set of 4 numbers) and X(ω) (magnitude and
phase). Note that X(ω) may be evaluated directly at = 0, /2, , and 3/2 by plugging in the
values into the expression given above; these are then the DFT numbers as well. The MATLAB
solutions are given below.
In MATLAB: The magnitude and phase plots of the DFT can be generated by the following
segment:
0
0 0.5 1 1.5 2 2.5 3
k
1
Phase
-1
-2
0 0.5 1 1.5 2 2.5 3
k
The magnitude and phase plots of the DTFT can be generated by the following segment:
3
Magnitude
0
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2
Frequency, Hz
2
Phase - Radians
-1
-2
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2
Frequency, Hz
Example 2.4.8 Compute the discrete Fourier transform of the following finite length sequences
considered to be of length N.
1) x(n) = δ(n+n0), 0 < n0 < N
2) x(n) = an, 0 < a < 1
Solution See Ramesh Babu 3.16.
Note that x(n) = δ(n+n0) would be zero everywhere except at n = –n0 which is not in the
range [0, N). So make it δ(n–n0).
Example 2.4.9 [2008] Compute the N-point DFT X(k) of the sequence
x(n) = cos (2n/N), 0 ≤ n ≤ N–1
for 0 ≤ k ≤ N–1.
Solution Express cos (2n/N) as (e j 2 n / N e j 2 n / N ) / 2 .
Example 2.4.10 Obtain the 7-point DFT of the sequence x(n) = {1, 2, 3, 4, 3, 2, 1} by taking 7
samples of its DTFT uniformly spaced over the interval 0 ≤ ω ≤ 2π.
Solution The sampling interval in the frequency domain is 2π/7. From Example 4 we have
X (e j ) or X(ω) = 1+ 2e j1 + 3e j 2 + 4e j3 + 3e j 4 + 2e j5 +1e j 6
= (2 cos 3 +4 cos 2 +6 cos +4) e j3
The DFT, X (k) , is given by replacing ω with k(2π/7) where k is an index ranging from 0 to 6:
DFT = X () = X (2k / 7) , k = 0 to 6
2 k / 7
MATLAB:
w = 0: 2*pi/7: 2*pi-0.001
XkfromDTFT = (4+6*cos(w)+4*cos(2*w)+2*cos(3*w)) .* exp(-j*3*w)
MATLAB solution:
This is the 7-point DFT obtained by sampling the DTFT at 7 points uniformly spaced in (0, 2π).
It should be the same as the DFT directly obtained, for instance, by using the fft function in
MATLAB:
MATLAB:
xn = [1 2 3 4 3 2 1]
Xkusingfft = fft(xn)
MATLAB solution:
Example 2.4.11 Obtain the 7-point inverse DTFT x(n) by finding the 7-point inverse DFT of
X(k):
MATLAB:
MATLAB solution:
X (e j ) or X(ω) = 1+ 2e j1 + 3e j 2 + 4e j3 + 3e j 4 + 2e j5 +1e j 6
= (2 cos 3 +4 cos 2 +6 cos +4) e j3
The DFT then is given by
MATLAB:
w = 0: 2*pi/6: 2*pi-0.001
Xk6point = (4+6*cos(w)+4*cos(2*w)+2*cos(3*w)) .* exp(-j*3*w)
MATLAB solution:
Xk6point = [16, (-3.0000 - 0.0000i), (1.0000 + 0.0000i), 0, (1.0000 + 0.0000i),
(-3.0000 - 0.0000i)]
This is the 6-point DFT obtained by sampling the DTFT at 6 points uniformly spaced in (0, 2π).
Example 2.4.13 Obtain the 6-point inverse DTFT x(n) by finding the 6-point inverse DFT of
Xk6point:
MATLAB:
MATLAB solution:
xn = [2 2 3 4 3 2]
Example 2.4.14 What will be the resulting time sequence if the DTFT of the 7-point sequence is
sampled at 8 (or more) uniformly spaced points in (0, 2π) and its inverse DFT is obtained?
Solution The sampling interval in the frequency domain now is 2π/8. From Example 4 we have
X (e j ) or X(ω) = 1+ 2e j1 + 3e j 2 + 4e j3 + 3e j 4 + 2e j5 +1e j 6
= (2 cos 3 +4 cos 2 +6 cos +4) e j3
The DFT then is given by
MATLAB:
w = 0: 2*pi/8: 2*pi-0.001
Xk8point = (4+6*cos(w)+4*cos(2*w)+2*cos(3*w)) .* exp(-j*3*w)
MATLAB solution:
This is the 8-point DFT obtained by sampling the DTFT at 8 points uniformly spaced in (0, 2π).
Example 2.4.15 Obtain the 8-point inverse DTFT x(n) by finding the 8-point inverse DFT of
Xk8point:
MATLAB:
MATLAB solution:
xn = [1 2 3 4 3 2 1 0]
We see that the original 7-point sequence has been preserved with an appended zero. The
original sequence and the zero-padded sequence (with any number of zeros) have the same
DTFT. This is a case of over-sampling the continuous-ω function X(ω): there is no time-domain
aliasing. This is similar to the situation that occurs when a continuous-time function x(t) is over-
sampled: the corresponding frequency domain function Xs () is free from frequency-domain
aliasing.
%Sketch of sequences
n = 0:1:6; xn = [1, 2, 3, 4, 3, 2, 1];
subplot (3, 1, 1), stem(n, xn)
xlabel('n'), ylabel('x(n)-7point'); grid
%
n = 0:1:5; xn = [2 2 3 4 3 2];
subplot (3, 1, 2), stem(n, xn)
xlabel('n'), ylabel('x(n)-6point'); grid
%
n = 0:1:7; xn = [1, 2, 3, 4, 3, 2, 1, 0];
subplot (3, 1, 3), stem(n, xn)
xlabel('n'), ylabel('x(n)-8point'); grid
4
x(n)-7point
0
0 1 2 3 4 5 6
n
4
x(n)-6point
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
n
4
x(n)-8point
0
0 1 2 3 4 5 6 7
n
Properties of DFT
The properties of the DFT (for finite duration sequences) are essentially similar to those of the
DFS for periodic sequences and result from the implied periodicity in the DFT representation.
(1) Periodicity If x(n) and X(k) are an N-point DFT pair, then X(k) (and x(n)) is periodic with a
periodicity of N. That is
This can be proved by replacing k by k+N in the defining equation for X(k).
(2) Linearity For two sequences x1(n) and x2(n) defined on [0, N–1], if x3(n) = a x1(n) + b x2(n)
then
If one of the two sequences x1(n) and x2(n) is shorter than the other then the shorter one must be
padded with zeros to make both sequences of the same length.
(3) Circular shift or circular translation of a sequence (The sequence wraps around). The
circular shift, by an amount n0 to the right, of the sequence x(n) defined on [0, N–1] is denoted by
x((n–n0)mod N) or x((n–n0))N. For example, if x(n) is
The operation can be thought of as wrapping the part that falls outside the region of interest
around to the front of the sequence, or equivalently, just a straight (linear) translation of its
periodic extension.
Example 2.5.1 Given x(n) = {1, 2, 2, 0}. Here N = 4. The circular shift of x(n) by one unit to the
right is x((n–1))4, and is given by
x((n–1))4 = {0, 1, 2, 2}
where the 0 has been wrapped around to the start and the other values are shifted one unit to the
right.
Alternatively, we can view this as a straight translation of the periodic extension outside
the range [0, 3] of the given sequence. The periodic extension xp(n) is shown below:
xp(n) = {… 2, 2, 0, 1, 2, 2, 0, 1, 2, 2, 0, 1, 2, 2, 0, 1, …}
n=0
The periodic extension, when shifted to the right by one unit, appears as below; and the
circularly shifted version x((n–1))4 is the shaded part defined over 0 n 3 only:
x((n–1))4
xp(n –1) = {… 1, 2, 2, 0, 1, 2, 2, 0, 1, 2, 2, 0, 1, 2, 2, 0, …}
n=0
x(n)
2 2
1
0
n
0 1 2 3
2 2 2 2 2 2
1 1 1
0 0 0
n
–6 –4 –2 0 1 2 3 4 5 6
xp(n–1) (shifted by 1)
2 2 2 2 2 2
1 1 1
0 0 0
n
–6 –4 –2 0 1 2 3 4 5 6
2 2
1
0
n
0 1 2 3
Example 2.5.2 Given x(n) = {1, 2, 2, 0}, sketch x((n–k))4 where k is the independent variable.
2 xp(0–k)
x(k) 2 2 2 2
1 1 1
2 1
0 0 0 k
–6 –4 –2 0 1 2 3 4 5 6
x((–k))4
0 x((0–k ))4 = circular shift of
x(–k) to the right by 0 units
xp(1–k)
2 2 2 2
1 1 1
0 0 0 k
–5 –4 –2 0 1 2 3 4 5 6
Circular convolution The N-point circular convolution of two sequences x1(n) and x2(n) denoted
by x1(n) ©N x2(n) is defined as follows:
N 1 N 1
This property is used to perform circular convolution of two sequences by first obtaining their
DFTs, multiplying the two DFTs, then taking the inverse DFT of the product.
Example 2.5.3 [Circular convolution] For the two sequences x1(n) = {1, 2, 2, 0} and x2(n) = {0,
1, 2, 3} find y(n) = x1(n) ©4 x2(n).
3
Solution We use the form y(n) = x1(n) ©N x2(n) = x1 ((n k))4 x2 (k) which uses the circularly
k0
shifted version x1((n–k))4. The values of the sequence x1(k) = {1, 2, 2, 0} are arranged on a circle
in counterclockwise direction starting at point A. The sequence x1((–k))4 is then read off in the
clockwise direction starting at A. Thus x1((–k))4 = {1, 0, 2, 2}. See figure below.
2 1 A
As an alternative we may also obtain the sequence x1((–k))4 by periodically extending x1(k)4,
reflecting it about k = 0, and truncating it outside the range 0 ≤ k ≤ 3.
The value
3
x2(k) 0 1 2 3
x1((–k))4 1 0 2 2
Thus y(0) = (0) (1) +(1) (0) +(2) (2) +(3) (2) = 10.
For n = 1 the value
3
is obtained as follows: the sequence x1((1–k))4 is obtained from x1((–k))4 by shifting the latter to
the right by 1 with wrap around; we then line up x1((1–k))4 below x2(k), multiply and add to get
y(1):
x2(k) 0 1 2 3
x1((1–k))4 2 1 0 2
The result is y(1) = (0) (2) +(1) (1) +(2) (0) +(3) (2) = 7.
The procedure is continued for successive values of n, at each step using the circularly-
shifted-by-1 version of the previous x1((n–k))4.
Circular convolution – Matrix method The circular convolution of the two sequences x1(n)
and x2(n) is given by:
N 1
Step 1. By zero-padding make sure the two sequences are of the same length, say, N.
Step 2. Arrange the various circularly shifted versions of x1(.) as a matrix and x2(.) as a
vector; then multiply to get the vector x3(.) which is the desired result.
The matrix formed by the shifted versions of x1(.) is shown below. It displays somewhat
more terms than is possible to show in the complete multiplication equation shown farther down
below.
x1(3)
x1(2)
x1(1)
x1(0) Start
x1(N–1)
x1(N–2)
x1(N–3)
x2(3)
x2(2)
x2(1)
Start x20)
x2(N–1)
x2(N–2)
x2(N–3)
x1 (0) x1 (N 1) . x1 (3) x1 (2) x1 (1) x2 (0) x3 (0)
x1 (0) . x1 (4) x1 (3) x1 (2)
x1 (1) x2 (1) x3 (1)
. . . . . . . .
=
. . . . . . .
.
x (N 2) x (N 3) . x (1) x (0) x (N 1) x 2 (N 2) x (N 2)
1 1 1 1 1 3
x1 (N 1) x1 (N 2) . x1 (2) x1 (1) x1 (0) x2 (N 1) x3 (N 1)
As an example the element x3(0) is given by
x1(n) x2(n)
Zero Zero
padding padding
n n
0 N1–1 N–1 0 N2–1 N–1
Example 2.5.4 [Circular and linear convolution] (a) Determine the 4-point circular
convolution of the sequences
Example 2.5.5 [2007] Compute the circular convolution of the sequences x1(n) = {1, 2, 0, 1} and
x2(n) = {2, 2, 1, 1} using the DFT approach.
Solution The sequences are of the same length, so no zero padding is needed. The length of
{x1(n) ©N x2(n)} is 4 (= N). Use the property that if x1(n) X1(k) and x2(n) X2(k) and x3(n) =
x1(n) ©N x2(n), then x3(n) X3(k) = X1(k) X2(k):
where X1(k) and X2(k) are the N-point DFTs of x1(n) and x2(n), respectively. The following steps
are involved in computing x1(n) ©N x2(n):
Example 2.5.6 Compute the linear convolution of the sequences x(n) = {1, 2, 0, 1} and y(n) =
{2, 2, 1, 1} using the DFT approach.
Solution The length of x(n)*y(n) is 7 (= 4+4–1). We zero-pad the sequences to a length of 7 each
and perform circular convolution of the 7-point sequences; the result will be the same as the
linear convolution of the original 4-point sequences. The following steps are involved in
computing x(n)*y(n):
Example 2.5.7 Compute the linear convolution of the sequences x(n) = {1, 2} and y(n) = {2, 2,
1} using the DFT approach.
Solution The length of x(n)*y(n) is 4 (= 2+3–1). We zero-pad the sequences to a length of 4 each
and perform circular convolution of the 4-point sequences; the result will be the same as the
linear convolution of the original 2- and 3-point sequences. The following steps are involved in
computing x(n)*y(n):
1. Augment the sequences x(.) and y(.) by zero-padding: xa(n) = {1, 2, 0, 0} and
ya(n) = {2, 2, 1, 0}
2. Find Xa(k) = DFT4{xa(n)} and Ya(k) = DFT4{ya(n)}.
3. Compute the product Xa(k) Ya(k)
4. Compute x(n)*y(n) = xa(n) ©4 ya(n) = IDFT{Xa(k) Ya(k)}
Convolution – Overlap-and-add The response, y(n), of a LTI system, h(n), can be obtained by
linear convolution
Let the impulse response {h(n), n = 0 to M–1} be of finite length M. The input sequence {x(n), n
= 0 to S–1} is long but of finite length S. Recall that
Further, let h(n) be defined to be zero everywhere except over the interval [N1, N2]. Similarly, let
x(n) be defined to be non-zero over [N3, N4]. Then y(n) is non-zero over [(N1+ N3), (N2+ N4)].
One way to perform the convolution in pseudo real time (i.e., real time with a finite
delay) is by sectionalizing the input. We divide x(n) into K sections of length M each, where K
= S M :
x1(n) = x(n), 0 ≤ n ≤ M –1
0, elsewhere
…
In the Kth section (the last section) zeros may have to be appended. If, for instance, x(n) = {3, –1,
0, 1, 3, 2, 0, 1, 2, 1} with S = 10 and h(n) = {1, 1, 1} with M = 3, we have K = 10 3 = 4, with
the 4th section containing two appended zeros, and the sections are
In general, then, x(n) can be written as the sum of all the sections
K
x(n) = xi (n)
i1
where yi (n) = xi (n) h(n) are the output sections. Let us examine y1(n) and y2(n). For i = 1 we
have
Since x1(n) and h(n) are of lengths M each and they are defined to be non-zero over [0, M–1] and
[0, M–1] respectively, the result y1(n) will be non-zero over [0, 2M–2] and of length (2M–1).
Similarly, for i = 2, x2(n) is defined over [M, 2M–1] while h(n) remains unchanged. The resulting
y2 (n) then is non-zero from (0+M) to (M–1 + 2M–1), i.e., over [M, 3M–2] with a length of (2M–
1). Comparing y1 (n) and y2 (n) it is seen that they overlap in the interval M ≤ n ≤ (2M–2), over a
range of (2M–2) – M +1 = M–1 points. Consequently the two must be added in this range (see
figure). This amounts to adding (M–1) pairs of data.
Overlap (Add)
(M–1) points
M 2M –2 3M–2
In a similar fashion x3(n) is defined over 2M ≤ n ≤ (3M–1), so that y3 (n) is non-zero over
[2M, (4M–2)]. Comparing y2 (n) and y3 (n) it is seen that they overlap in the interval 2M ≤ n ≤
(3M–2), consequently the two must be added in this range. This amounts to adding ((3M–2) –
2M +1) or (M–1) pairs of data.
The overlap interval of y1 (n) and y2 (n) is disjoint from that of y2 (n) and y3 (n) . In
general, the overlap intervals of successive pairs of yi (n) are mutually exclusive. Thus we
calculate successive yi (n) for i = 0 to K and add each successive yi (n) to the previous yi (n) in
the overlap region. Hence the procedure is called the overlap-and-add method. Each convolution
could be obtained by using the DFT of size (2M–1) or greater so that the resulting circular
convolution would be a linear convolution. In principle rather than using the DFT we could zero-
pad h(n) and each of the xi (n) ’s to a length of (2M–1) and perform circular convolution to
generate the yi (n) ’s which are then overlapped and added.
Input divided into sections of length L In the above development we divided x(n) into K sections
of length M each, where K = S M . This need not be the case. We could divide x(n) into (some
number of) sections of length L each. The situation now looks as below and the overlap occurs
over a range of (M–1) points – the same as before.
Overlap (Add)
(M–1) points
L L+M –2 2L+M–2
Once again each new section xi (n) and h(n) are zero-padded to a length of (L+M –1) and circular
convolution performed to generate the new yi (n) ’s which are overlapped and added to generate
y(n).
Note A little reflection shows that the input sequence x(n) need not be of finite length. As the
stream of input samples arrives we could sectionalize it into blocks of size L and proceed as
discussed above to generate the stream of blocks of y(n) as a continuous process.
Example 2.5.7 [Ramesh Babu’s Example 3.14] Find the output y(n) of a filter with impulse
response h(n) = {1, 1, 1} and input x(n) = {3, –1, 0, 1, 3, 2, 0, 1, 2, 1}.
Symmetry properties of the DFT Notation: RN(n) = 1 in [0, N–1], and 0 elsewhere. Thus
x((n+m))N RN(n) means the circularly shifted version of the finite length sequence x(n) defined
over [0, N–1]. Sometimes the RN(n) is omitted.
The following properties should be noted.
Set n+m = λ so that n = λ–m and the limits n = 0 to N–1 become λ = m to N–1+m. Then the RHS
becomes
N 1 m
=
x(())
m
N
WNk WNkm
Based on the properties above, we can show that for a real sequence the following
symmetry properties of the DFT hold:
Example 2.5.9 [2009] Given that the real-valued sequence x(n) defined over 0 ≤ n ≤ N–1 has the
DFT X(k) = XR (k)+ jX I (k) , 0 k N–1 show that XR (k) is an even function and XI (k) is an odd
function of k.
Solution By definition we have
N 1
written
X(k) = X R (k)+ jX I (k) , 0 k N–1
Since cos(2kn/ N) is an even function of k, that is, cos(2 (k)n / N) = cos(2kn/ N) for all k, it
follows that XR (k) is an even function of k, that is, XR (k)= XR (k) for all k.
Similarly, since sin(2kn/ N) is an odd function of k, it follows that XI (k) is an odd
function of k.
Do the above results depend on whether x(n) is real-valued or not?
Example 2.6.1 (a) Find the frequency and period of (i) x1(n) = cos (πn/4) and (ii) x2(n) = cos
(πn/2). Sketch the sequences x1(n), x2(n), and x(n) = x1(n) + x2(n) for 0 n 7.
Solution Arrange cos (πn/4) in the format cos (2π f n). Thus, cos (πn/4) = cos (2π(1/8)n), from
which the digital frequency is identified as f = 1/8 cycle/sample or = π/4 rad/sample. The
sequence values are:
1 1 1 1
x1(n) = 1, , 0, – , –1, – , 0,
2 2 2 2
x2(n) = {1, 0, –1, 0, 1, 0, –1, 0}
1 1 1 1
x(n) = x1(n) + x2(n) = 2, , –1, – , 0, – , –1,
2 2 2 2
The sequences x1(n), x2(n) and x(n) are sketched below.
1
1/ 2
n
1 7 8
1/ 2
–1
n
1 7 8
–1
1/ 2
n
1 7 8
1/ 2
–1
In MATLAB the following segment plots the three functions x1(t), x2(t) and x(t).
-1
0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45 0.5
t
x2(t) = cos 24t
1
x2(t)
-1
0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45 0.5
t
x(t) = cos 22t + cos 24t
2
x(t)
-2
0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45 0.5
t
In MATLAB the following segment plots the two functions x1(n), x2(n) and x(n).
The sequence is x(n) = {2, 0.707, -1, -0.707, 0, -0.707, -1, 0.707}
-1
0 1 2 3 4 5 6 7 8
n
x2(n) = cos( n/2)
1
x2(n)
-1
0 1 2 3 4 5 6 7 8
n
x(n) = cos( n/4)+ cos( n/2)
2
x(n)
-2
0 1 2 3 4 5 6 7 8
n
Example 2.6.1 (b) Find the 8-point DFT (8-point FFT using either DIT or DIF, or use the direct
calculation) of x1(n) = cos (πn/4), for 0 n 7. Sketch the sequence X1(k).
In MATLAB the following segment plots the magnitude and phase angle of X1(k):
!!! Note that all phase angle values should be zeros, that is, X1 (k) = 0 for all k.
The MATLAB plots for magnitude and phase angle are shown below. The 2 Hz component is
indicated by X1(1) = 4 (and, from symmetry considerations, X1(7) = 4).
With regard to the phase angle, strictly speaking, the phase of X1(k) = 0 for all k since
X1(k) is real valued for all k. Check out why!!!: When the input is listed explicitly as
the program gives the correct phase angle calculations, but not when it is specified implicitly as
Magnitude of X1(k)
4
3
|X1(k)|
0
0 1 2 3 4 5 6 7
k
Phase of X1(k)
4
2
<X1(k)
-2
-4
0 1 2 3 4 5 6 7
k
Example 2.6.1 (c) Find the 8-point DFT of x(n) = cos (πn/4) + cos (πn/2), for 0 n 7. Sketch
the sequence X(k).
Solution Consider the 8-point sequence x(n) for n = 0 to 7 obtained by sampling x(t) at 16 Hz.
The length of the sequence is N = 8. The sequence values are
1 1 1 1
x(n) = 2, , –1, – , 0, – , –1,
2 2 2 2
The corresponding DFT is given by
N 1
X(k) = {0, 4, 4, 0, 0, 0, 4, 4}
k=0
The DFT is sketched below: there is a component at 2 Hz. (k = 1) and another at 4 Hz. (k = 2) as
would be expected.
X(k)
Line of Symmetry
4
k
–3 –2 –1 0 1 2 3 4 5 6 7 8
Fs = 16 Hz
F0 = 2 Hz
Note that the DFT sequence shows a component at 2 Hz and another at 4 Hz, corresponding to k
= 1 and 2 respectively.
In MATLAB the following segment plots the magnitude and phase angle of X(k). Note
that x(n) is specified by an explicit list.
3
|X(k)|
0
0 1 2 3 4 5 6 7
k
Phase of X(k)
1
0.5
<X(k)
-0.5
-1
0 1 2 3 4 5 6 7
k
Example 2.6.1 (d) [Filtering] Next we would like to filter the sequence x(n) = cos (πn/4) + cos
(πn/2) so that the 4 Hz component is removed.
Solution In terms of the DFT sequence X(k) this means setting X(2) and X(6) to zero. In order to
preserve the symmetry properties of the DFT we should set both X(2) and X(6) = 0, not just X(2).
The resulting DFT sequence is denoted Xf(k) and is given by
Xf(k) = {0, 4, 0, 0, 0, 0, 0, 4}
k=0
We next find the inverse DFT of the above Xf(k) by using either the DIT or the DIF form of the
FFT. The result is denoted by xf(n). Using the IDFT formula we have
1 N 1
xf(n) = X f k e j 2 k n / N , n = 0, 1, … , N–1
N k0
7
= X k e j 2 k n / 8 ,
1
n = 0 to 7
8 k0 f
It will be seen that xf(n) is equal to the original x1(n) component (= cos πn/4, from the 2 Hz.
component; see plot of x1(n) earlier); that is
1 1 1 1
xf(n) = x1(n) = 1, , 0, – –1, – , 0,
2 2 2 2
This is low pass filtering where we have selectively removed the 4 Hz component.
In MATLAB the following segment finds the inverse DFT, xf(n), from the given Xf(k).
0.8
0.6
0.4
0.2
xf(n)
-0.2
-0.4
-0.6
-0.8
-1
0 1 2 3 4 5 6 7
n
To remove all frequency components above 2 Hz (in this example the 4, 6 and 8 Hz
components), we set X(2) = X(6) = 0 for the 4 Hz, X(3) = X(5) = 0 for the 6 Hz, and X(4) = 0 for
the 8 Hz, once again preserving symmetry. In this example, of course, there are no 6 or 8 Hz
components.
Similarly high pass filtering is done by deleting X(1) and X(7) – set them to zero –
preserving symmetry once again. In this case XfHP(k) = {0, 0, 4, 0, 0, 0, 4, 0}.
Picket-fence effect
Example 2.7.1 The signal x(t) = cos 2π2t is sampled at 16 Hz.
(a) What frequency components do you expect to see in its DFT?
(b) Take 8 samples and calculate the 8-point DFT.
Solution (b) Using x(n) = cos 2π2n(1/16) = cos (πn/4), the sequence values are
x(n) = {1, 1/sqrt(2), 0, -1/sqrt(2), -1, -1/sqrt(2), 0, 1/sqrt(2)}
Note that the average value of the sequence (the dc component) is zero. The MATLAB program
follows:
X(k) = {0 4 0 0 0 0 0 4}
X (k) = {0 4 0 0 0 0 0 4}
X (k) = {0 0 0 0 0 0 0 0}
The frequency resolution is Fs/N = 16/8 = 2 Hz. The table below shows that the 8-point
DFT contains a component at 2 Hz, corresponding to k = 1. The DFT values are all real numbers
symmetrically disposed about k = 4, the center of symmetry.
k=0
X(k) = {0, 4, 0, 0, 0, 0, 0, 4}
Hz 0 2 4 6 8 10 12 14
(Fs/2)
Magnitude of X(k)
4
|X(k)|
2
0
0 1 2 3 4 5 6 7
k
Phase of X(k)
1
0.5
<X(k)
-0.5
-1
0 1 2 3 4 5 6 7
k
Example 2.7.2 [Zero-padding] The first 8 sample values of a 2-Hz cosine, x(t) = cos 2π2t,
obtained at a sampling rate of 16 samples/second are given below:
Note that when zero padded the average value of the sequence is no longer zero. The frequency
resolution of the DFT is
Sampling Frequency Fs 16 Hz
Frequency resolution = = = = 1 Hz.
Number of po int s N 16
The 2 Hz component corresponds to X(k) with k = 2.
In MATLAB:
Magnitude of X(k)
4
|X(k)|
0
0 5 10 15
k
Phase of X(k)
2
<X(k)
-2
0 5 10 15
k
Zero-padded sequence xn16
1
x(n)
-1
0 5 10 15
n
Example 2.7.3 [Without zero-padding] Given all 16 sample values of a 2-Hz cosine, x(t) = cos
2π2t, obtained at a sampling rate of 16 samples/second find its 16-point DFT.
Solution The frequency resolution of the DFT is
Sampling Frequency Fs 16 Hz
Frequency resolution = = = = 1 Hz.
Number of po int s N 16
The 2 Hz component corresponds to X(k) with k = 2.
Magnitude of X(k)
10
|X(k)|
0
0 5 10 15
k
Phase of X(k)
5
<X(k)
-5
0 5 10 15
k
Sequence x(n)
1
x(n)
-1
0 5 10 15
n
Specifying the sequence values explicitly as below produces correct phase values (rather
than implicitly by n = 0: 1 : 15; x = cos (pi*n/4), X = fft(x))
Magnitude of X(k)
10
|X(k)|
0
0 5 10 15
k
Phase of X(k)
1
<X(k)
-1
0 5 10 15
k
16-point sequence xn
1
x(n)
-1
0 5 10 15
n
k 0 2 8 15
X(k) {0 0 8 0 0 0 0 0 0 0 0 0 0 0 8 0}
Hz 2 8
Example 2.7.4 The signal x(t) = cos 2π2t is sampled at 12 Hz (still satisfies the sampling
theorem). Calculate (1) the 6-point DFT and (2) the 8-point DFT. Compare the results.
Solution The resulting sequence is x(n) = cos 2π2n(1/12) = cos (πn/3).
(1) 6-point DFT.
X(k) = {0, 3, 0, 0, 0, 3}
Example 2.7.5 For the signal x(t) = cos 2π2t + cos 2π4t choose a sampling frequency of 12Hz
(still satisfies sampling theorem). Find the N-point DFT for (a) N = 6, (b) N = 8, and (c) N = 12.
(a) For N = 6
The dc component is zero. The frequency resolution is Fs/N = 12/6 = 2 Hz. The DFT is
X(k) = {0, 3, 3, 0, 3, 3}
k 0 3 5
X(k) {0 3 3 0 3 3
Hz 0 2 4 6 8 10
(b) For N = 8
This particular set has a nonzero dc component. The frequency resolution is Fs/N = 12/8 = 1.5
Hz. The DFT is
k 0 4 7
X(k) {2 3+j3 0 3–j3 2 3+j3 0 3–j3
Hz 0 1.5 3 4.5 6 7.5 9 10.5
X(k)
2 Hz 4 Hz
k
0 1 2 8
1.5 Hz 3 Hz 12 Hz
Example 2.7.6 For the signal x(t) = cos 2π2t + cos 2π3t + cos 2π4t choose a sampling frequency
of 12Hz (still satisfies sampling theorem). Find the N-point DFT for (a) N = 6, (b) N = 8.
(a) For N = 6
The dc component is not zero. The frequency resolution is Fs/N = 12/6 = 2 Hz. The DFT is
Both the 2 Hz and the 4 Hz components show up, but the 3 Hz component is missing.
k 0 3 5
X(k) {1 4 + j1.732 4 - j1.732 1 4 + j1.732 4 - j1.732
Hz 0 2 4 6 8 10
Digital Signal Processing – 2(B)
Contents:
Introduction
Radix-2 decimation-in-time FFT (Cooley-Tukey)
Radix-2 decimation-in-frequency FFT (Sande-Tukey)
Inverse DFT using the FFT algorithm
*Decimation-in-time algorithm for N = 4 (Cooley-Tukey formulation)
*Decimation-in-frequency algorithm for N = 4 (Sande-Tukey formulation)
FFT with general radix
Introduction
For a finite-duration sequence x(n) of length N, the DFT sum may be written as
N 1
and therefore requires four real multiplications and two real additions. Each complex addition is
of the form
and requires two real additions. Thus the computation of all N values of the DFT requires 4N2
real multiplications and 4 N 2 (= 2 N 2 + 2 N 2 ) real additions.
Efficient algorithms which reduce the number of multiply-and-add operations are known
by the name of fast Fourier transform (FFT). The Cooley-Tukey and Sande-Tukey FFT
algorithms exploit the following properties of the twiddle factor (phase factor), WN = e j 2 / N
(the factor e j 2 / N is called the Nth principal root of 1):
N
k
k
1. Symmetry property WN 2 = –W N
2. Periodicity property W Nk N = W Nk
To illustrate, for the case of N = 8, these properties result in the following relations:
1j
W80 = – W84 = 1 W81 = – W 85 =
2
1 j
W82 = – W86 = –j W83 = – W87 =
2
The use of these properties reduces the number of complex multiplications from N2 to
N
log 2 N (actually the number of multiplications is less than this because several of the
2
multiplications by W Nr are really multiplications by ±1 or ±j and don’t count); and the number of
complex additions are reduced from N 2 to N log2 N . Thus, with each complex multiplication
requiring four real multiplications and two real additions and each complex addition requiring
two real additions, the computation of all N values of the DFT requires
N
Number of real multiplications = 4 2 log2 N = 2N log2 N
N
Number of real additions = 2N log2 N + 2 log2 N = 3N log2 N
2
We can get a rough comparison of the speed advantage of an FFT over a DFT by
computing the number of multiplications for each since these are usually more time consuming
than additions. For instance, for N = 8 the DFT, using the above formula, would need 82 = 64
8
complex multiplications, but the radix-2 FFT requires only 12 (= log 8 = 4 x 3).
2
2
Number of multiplications: DFT vs. FFT
No. of points No. of complex multiplications No. of real multiplications
N DFT FFT DFT FFT
32 1024 80 4096 320
128 16384 448 65536 1792
1024 1048576 5120 4194304 20480
We consider first the case where the length N of the sequence is an integral power of 2,
that is, N = 2ν where ν is an integer. These are called radix-2 algorithms of which the
decimation-in-time (DIT) version is also known as the Cooley-Tukey algorithm and the
decimation-in-frequency (DIF) version is also known as the Sande-Tukey algorithm. We
show first how the algorithms work; their derivation is given later.
For a radix of (r = 2), the elementary computation (EC) known as the butterfly consists
of a single complex multiplication and two complex additions.
If the number of points, N, can be expressed as N = rm , and if the computation algorithm
is carried out by means of a succession of r-point transforms, the resultant FFT is called a radix-
r algorithm. In a radix-r FFT, an elementary computation consists of an r-point DFT followed
by the multiplication of the r results by the appropriate twiddle factor. The number of ECs
required is
N
Cr =
log r N
r
which decreases as r increases. Of course, the complexity of an EC increases with increasing r.
For r = 4, the EC requires three complex multiplications and several complex additions.
Suppose that we desire an N-point DFT where N is a composite number that can be
factored into the product of integers
N = N1 N2 … Nm
If, for instance, N = 64 and m = 3, we might factor N into the product 64 = 4 x 4 x 4, and the 64-
point transform can be viewed as a three-dimensional 4 x 4 x 4 transform.
If N is a prime number so that factorization of N is not possible, the original signal can be
zero-padded and the resulting new composite number of points can be factored.
Radix-2 decimation-in-time FFT (Cooley-Tukey)
Procedure and important points
Separation of 1
Separation of 2
Separation of 4
6. The number of complex additions = N log2 N and the number of complex multiplications
N
is log N .
2
2
7. The elementary computation block in the flow graph, calledk the butterfly, is kshown here.
This is an in-place calculation in that the outputs (A + BW ) and (A – BW ) can be
N N
computed and stored in the same locations as A and B.
A A + BW Nk
B WNk A – BW Nk
Example 2.2.1 Radix-2, 8-point, decimation-in-time FFT for the sequence
n 0 1 2 3 4 5 6 7
x(n) = {1, 2 3 4 –4 –3 –2 –1}
W8 = e =e W8 = e =e
2 j / 2 3
=–j =– –j
2 2
A + BW Nk
A
=1 =1–4=–3
B W80 A – BW Nk
=1 =1+4=5
=–4
Bit-reversed Natural
order Stage 1 Stage 2 Stage 3 order
000 000 x(0) = 1 X(0) = 0
A A+B
W Nk
B (A – B)W Nk
Example 2.3.1 Radix-2, 8-point, decimation-in-frequency FFT for the sequence
n 0 1 2 3 4 5 6 7
x(n) = {1, 2 3 4 –4 –3 –2 –1}
Solution The twiddle factors are the same as in the DIT FFT done earlier (both being 8-point
DFTs):
0 1 j 2 / 8 1 1
W8 = 1 W8 = e = –j
2 2 1 1
j 2 / 8 2 j 2 / 8 3 j 3 / 4
W8 = e =e =–j W8 = e =e
2 j / 2 3
=– –j
2 2
One of the elementary computations is shown below:
A A+B
=1 W80 = 1 = 1 – 4 = –3
B (A – B)W Nk
= –4 = (1 + 4) 1 = 5
x(0) = 1 X(0) =
W80 W80 W80
x(1) = 2 X(4) =
W81 W82
x(3) = 4 X(6) =
W83
x(4) = –4 X(1) =
W80 W80
x(5) = –3 X(5) =
W82
x(7) = –1 X(7) =
8-point FFT using DIF
Results of the first stage
Input Stage 1 Stage 2 Stage 3 (Output)
1 1 + (–4) = –3
2 2 + (–3) = –1
3 3 + (–2) = 1
4 4 + (–1) = 3
– 4 (1 – (–4)) 1 = 5
– 3 (2 – (–3)) e j / 4 = 5 e j / 4
– 2 (3 – (–2)) (–j) = –j5
– 1 (4 – (–1)) e j3 / 4 = 5 e j3 / 4
The DFT is X(k) = {0, (5 – j12.07), (–4 + j4), (5 – j2.07), –4, (5 + j2.07), (–4 – j4), (5 + j12.07)}
A A + BW Nk
B WNk A – BW Nk
A A+B
WNk
B (A – B)W Nk
N x (n) = X * (k)W Nk n
*
k0
The right hand side of the above equation is simply the DFT of the sequence X*(k) and can be
computed by using any FFT algorithm. The desired output sequence is then found by taking the
conjugate of the result and dividing by N
1 N 1 * kn
*
x(n) = X (k)W
N k 0
N
Example 2.4.1 Given the DFT sequence X(k) = {0, (–1–j), j, (2+j), 0, (2–j), –j, (–1+j)} obtain the
IDFT x(n) using the DIF FFT algorithm.
Solution This is an 8-point IDFT. The 8-point twiddle factors are, as calculated earlier,
0 1 j 2 / 8 1 1
W8 = 1 W8 = e = –j
2 j 3 /24 1 1
j 2 / 8 2 j 2 / 8 3
W8 = e =e =–j W8 = e =e
2 j / 2 3
=– –j
2 2
A A+B
W Nk
B (A – B)W Nk
Natural Bit-reversed
order Stage 1 Stage 2 Stage 3 order
X*(0) = 0 8 x*(0) =
W 80
X*(1) = 8 x*(4) =
X*(3) = 8 x*(6) =
X*(4) = 0 8 x*(1) =
X*(5) = 8 x*(5) =
X*(6) = j 8 x*(3) =
X*(7) = 8 x*(7) =
8-point IDFT using DIF FFT
Results of the first stage
Input Stage 1 Stage 2 Stage 3 (Output)
X*(k)
0 0+0=0
–1+j –1+j + 2+j = 1+j2
–j –j + j = 0
2–j 2–j + (–1–j) = 1–j2
0 (0 – 0) 1 = 0
2+j (–1+j – (2+j)) e j / 4 = –3 e j / 4
j (–j – j) (–j) = –2
–1–j (2–j – (–1–j)) e j3 / 4 = 3 e j3 / 4
8 x (n)
*
bit rev order = {2, –2, 4, –4, –6.24, 2.24, 6.24, –2.24}
The IDFT is given by arranging the data in normal order, taking the complex conjugate of the
sequence and dividing by 8:
8 x *
normalorder = {2, –6.24, 4, 6.24, –2, 2.24, –4, –2.24}
1 1 1 2.24
x(n) = , 6.24 1 6.24 , – , 2.24 , – ,
, ,
4 8 2 8 4 8 2 8
x(n) = {0.25, –0.78, 0.5, 0.78, –0.25, 0.28, –0.5, –0.28}
Note Because of the conjugate symmetry of {X(k)}, we should expect the sequence {x(n)} to be
real-valued.
The MATLAB program:
Example 2.4.2 Given the DFT sequence X(k) = {0, (1–j), j, (2+j), 0, (2–j), (–1+j), –j} obtain
the IDFT x(n) using the DIF FFT algorithm.
Solution There is no conjugate symmetry in {X(k)}. Using MATLAB
x(n) = {0.5, (-0.44 + 0.037i), (0.375 - 0.125i), (0.088 + 0.14i), (-0.75 + 0.5i),
(0.44 + 0.21i), (-0.125 - 0.375i), (-0.088 - 0.39i)}
2.7 FFT with general radix
N = N1 N2 … Nm
If, for instance, N = 64 and m = 3, we might factor N into the product 64 = 4 x 4 x 4, and the 64-
point transform can be viewed as a three-dimensional 4 x 4 x 4 transform.
If N is a prime number so that factorization of N is not possible, the original signal can be
zero-padded and the resulting new composite number of points can be factored.
We illustrate in the table below the situation for N = 64. Since 64 = 26, we can have a
radix-2 FFT; alternatively, since 64 = 43, we can also have a radix-4 FFT.
N = 64 = 26 = 43 = 82
Radix-2 Radix-4 Radix-8
No. of stages log2 64 = 6 log4 64 = 3 log8 64 = 2
No. of ECs per stage 64/2 = 32 64/4 = 16 64/8 = 8
Digital Signal Processing – 3
Contents:
Introduction
The normalized analog, low pass, Butterworth filter
Time domain invariance
Bilinear transformation
Nonlinear relationship of frequencies in bilinear transformation
Digital filter design – The Butterworth filter
Analog design using digital filters
Frequency transformation
The Chebyshev filter
The Elliptic filter
Introduction
Nomenclature With a0 = 1 in the linear constant coefficient difference equation,
a0 y(n) + a1 y(n–1) + … + aN y(n–N)
= b0 x(n) + b1 x(n–1) + … + bM x(n–M), a0 0
we have,
M
H(z) =
b z
i0
i i
1 ai z i
i 1
This represents an IIR filter if at least one of a1 through aN is nonzero, and all the roots of the
denominator are not canceled exactly by the roots of the numerator. In general, there are M finite
zeros and N finite poles. There is no restriction that M should be less than or greater than or equal
to N. In most cases, especially digital filters derived from analog designs, M ≤ N. Systems of this
type are called Nth order systems. This is the case with IIR filter design in this Unit.
When M > N, the order of the system is no longer unambiguous. In this case, H(z) may be
taken to be an Nth order system in cascade with an FIR filter of order (M – N).
When N = 0, as in the case of an FIR filter, according to our convention the order is 0.
However, it is more meaningful in such a case to focus on M and call the filter an FIR filter of M
stages or (M+1) coefficients.
Example The system H(z) = (1 z8 ) (1 z1 ) is not an IIR filter. Why (verify)?
IIR filter design An analog filter specified by the Laplace transfer function, Ha(s), may be
designed to either frequency domain or time domain specifications. Similarly, a digital filter,
H(z), may be required to have either (1) a given frequency response, or (2) a specific time
domain response to an impulse, step, or ramp, etc.
Analog design using digital filters, ωi = ΩiT Another possibility is that a digital filter may be
required to simulate a continuous-time (analog) system. To simulate an analog filter the discrete-
time filter is used in the A/D – H(z) – D/A structure shown below. The A/D converter can be
thought of roughly as a sampler and coder, while the D/A converter, in many cases, represents a
decoder and holder followed by a low pass filter (smoothing filter). The A/D converter may be
preceded by a low pass filter, also called an anti-aliasing filter or pre-filter.
We will usually be given a set of analog requirements with critical frequencies Ω1, Ω2,…,
ΩN in radians/sec., and the corresponding frequency response magnitudes K1, K2, …, KN in dB.
The sampling rate 1/T of the A/D converter will be specified or can be determined from the input
signals under consideration.
The general approach for the design is to first convert the analog requirements to digital
requirements and then design the digital filter using the bilinear transformation. The conversion
of the analog specifications to digital specifications is through the formula ωi = ΩiT. To show
that this is true, suppose that the input to the equivalent analog filter is xa(t) = sin it . The output
of the A/D converter with sampling rate 1/T becomes
Thus, the magnitude of the discrete-time sinusoidal signal is the same as the continuous time
sinusoid, while the digital frequency ωi is given in terms of the analog frequency Ωi by ωi = ΩiT.
Thus, the specifications for the digital filter become ω1, ω2, …, ωN with the
corresponding frequency response magnitudes K1, K2, …, KN. The digital frequency, ω, is in
units of radians. The procedure is conceptually shown in figure below.
The focus is on the low pass analog filter because once designed it can be transformed
into an equivalent quality high pass, band pass or band stop filter by frequency transformation.
The Butterworth, Chebyshev and elliptic filters are used as a starting point in designing digital
filters. We approximate the magnitude part of the frequency response, not the phase. Butterworth
and Chebyshev filters are actually special cases of the more difficult elliptic filter.
Because a constant divided by an Nth order polynomial in Ω falls off as ΩN it will be an
approximate low pass function as Ω varies from 0 to ∞. Therefore, an all-pole analog filter H(s)
= 1/D(s) is a good and simple choice for a low pass filter form and is used in both the
Butterworth and the type I Chebyshev filters. Moreover, for a given denominator order, having
the numerator constant (order zero) gives (for a given number of filter coefficients) the
maximum attenuation as Ω → ∞.
The normalized analog, low pass, Butterworth filter
As a lead-in to digital filter design we look at a simple analog low pass filter – an RC filter, and
its frequency response.
Example 3.2.1 Find the transfer function, Ha(s), impulse response, ha(t), and frequency response,
Ha(jΩ), of the following system.
R = 10kΩ
+ +
C = 20μF
Input = x(t) Output = y(t)
– –
|Ha(jΩ)|
0.707
Ω, rad./sec.
Ωc= 5
|H(Omega)| 0.8
0.6
0.4
0.2
-15 -10 -5 0 5 10 15
Omega, rad/sec
Phase
2
Phase of H(Omega)
-1
-2
-15 -10 -5 0 5 10 15
Omega, rad/sec
If we adjust the values of the components R and C so that 1 RC = 1, we would have Ha(s)
Such a normalized LP filter could be transformed to another LP filter with a different cut-off
frequency of, say, Ωc = 10 rad/sec by the low pass to low pass transformation s → s /10. The
transfer function then becomes
1 10
Ha(s) = =
s 1 s ( s /10) s 10
which still has a dc gain of 1. The gain of this filter could be scaled by a multiplier, say, K, so
that
10
Ha(s) = K
s 10
which has a dc gain of K and a cut-off frequency of Ωc = 10 rad/sec.
The frequency response of the normalized filter Ha(s) = 1/(s 1) is Ha(jΩ) = 1 ( j 1) . The
corresponding MATLAB plots are shown below using the function plot. Omega is a vector,
consequently we use “./” instead of “/” etc.
|H(Omega)|
0.5
0
-20 -15 -10 -5 0 5 10 15 20
Omega, rad/sec
Phase
2
Phase of H(Omega)
-1
-2
-20 -15 -10 -5 0 5 10 15 20
Omega, rad/sec
Butterworth filter The filter Ha(s) = 5/(s 5) is a first order Butterworth filter with cut-off
frequency Ωc = 5 rad/sec. Its magnitude response is given by
1
|H(jΩ)| =
1 / 5
2
0.9
0.8
|H(Omega)|
0.7
0.6
0.5
0.4
0 5 10 15
Omega, rad/sec
Frequency response analysis The frequency response analysis in the analog frequency (Ω)
domain is given by the following equations which may be used to illustrate, qualitatively, the
effect of LP, HP or BP analog filters on a signal.
X(s) Y(s)
H(s)
Similarly, if we have a digital filter H(z) the frequency response analysis in the digital
frequency (ω) domain is given by the following equations which may be used to illustrate,
qualitatively, the effect of LP, HP or BP digital filters on a signal.
X(z) Y(z)
H(z)
The Nth order Butterworth filter In general the magnitude response of the Nth order
Butterworth filter with cut-off frequency Ωc is given by
1
|H(jΩ)| =
1 / c 2 N
With the normalized frequency variable defined as r = / c , the MATLAB segment below
plots the magnitude response for 1st, 3rd, and 10th order filters, that is, N = 1, 3, and 10,
respectively. Note that as the filter order increases the response becomes flatter on either side of
the cut-off; and the transition (cut-off) becomes sharper.
r = 0: 0.1: 3;
H1 = 1./sqrt(1.+ r .^2);
H3 = 1./sqrt(1.+ r .^6);
H10 = 1./sqrt(1.+ r .^20);
plot (r, H1, r, H3, 'r', r, H10, 'k');
legend ('1st Order', '3rd Order', '10th Order');
xlabel ('Normalized frequency, r'), ylabel('|H(r)|'); grid; title ('Magnitude')
Magnitude
1
1st Order
0.9 3rd Order
10th
0.8 Order
0.7
0.6
|H(r)|
0.5
0.4
0.3
0.2
0.1
0
0 0.5 1 1.5 2 2.5 3
Normalized frequency, r
Writing down the Nth order filter transfer function H(s) from the pole locations Let us look
at some analog Butterworth filter theory.
1
(1) |H(jΩ)| = decreases monotonically with Ω. No ripples.
1 / c 2 N
(2) Poles lie on the unit circle in the s-plane (for the Chebyshev filter, in contrast,
they lie on an ellipse).
(3) The transition band is wider (than in the case of the Chebyshev filter).
(4) For the same specifications the Butterworth filter has more poles (or, is of higher
order) than the Chebyshev filter. This means that the Butterworth filter needs
more components to build.
|H(jΩ)|
1 Direction of
0.707 increasing
order of filter
Ω, rad./sec.
Ωc = 1
The normalized analog Butterworth filter has a gain of |H(jΩ)| = 1 at Ω = 0, and a cut-off
frequency of Ωc = 1 rad/sec. Given the order, N, of the filter we want to be able to write down its
transfer function from the pole locations on the Butterworth circle.
Example 3.2.2 Given the order N of the filter, divide the unit circle into 2N equal parts and place
poles on the unit circle at (3600/2N) apart. The H(s) will be made up of the N poles in the left half
plane only. Remember complex valued poles must occur as complex conjugate pairs. There will
jΩ
s-plane
ζ
–1 1
Radius = Ωc = 1
be no poles on the imaginary axis. Since the N poles must lie on the left half semicircle, when N
is odd the odd pole must be at s = –1. Thus, for N = 1, there is one pole, s1 = –1, and H(s) is
given by
1 = 1
H(s) = = 1
s s1 s (1) s 1
Example 3.2.3 Filter order N = 2 so that 2N = 4 and 3600/4 = 900. The pole plot is shown above.
The poles are at
1 1 1 1
s1 = j and s2 = j ,
2 2 2 2
jΩ
s-plane
Radius = Ωc = 1
ζ
–1 1
so that
1 1 1 1
H(s) = (s s1 1)(s s2 ) = j j
1
s s
2 2 2 2
2 1 2 2 1
Denominator is
1 2 1 2
1
Dr. = s – j =s 2 sj = s 2s 1
2 2 2 2 2
So
H(s) = 1
s 2s 1
2
Example 3.2.4 Filter order N = 3, so that 2N = 6 and 3600/6 = 600. Poles are at
1 3 1 3 1
s1, 2, 3 = – 1, j , and j
2 2 2
2 s2 + 2 s +1
jΩ
s-plane
s2 –s3
ζ
s1
1
s3 Radius = Ωc = 1
= s *2
1
H(s) =
1
(s 1) s j 3 s 1 j 3
2
2 2 2
Denominator is
1 2 2 3
Dr. = s 1 s j = s 1 s 1
2
2 4 s
So
1
H(s) =
s 1s 2 s 1
Example 3.2.5 Filter order N = 4, so that 2N = 8 and 3600/8 = 450. Poles are at
Wrong jΩ jΩ Correct
placement
s-plane s-plane
ζ ζ
1
H(s) =
(s cos ) j 2 2
sin 2 (s cos ) j2 2
sin 2
1
s 1.848 s 1s 2 0.765 s 1
H(s) = 2
Determining the order and transfer function from the specifications A typical magnitude
response specification is sketched below. The magnitudes at the critical frequencies Ω1 and Ω2
are A and B, respectively. Typically Ω1 is in the pass band or is the edge of the pass band and Ω2
is in the stop band or is the edge of the stop band. For illustrative purposes we have arbitrarily
Transition
band
|H(jΩ)|
Pass Stop
band band
A = 0.707
B = 0.25
Ω, rad./sec.
Ω1 Ω2
taken A = 0.707 (thus Ω1 is the cut-off frequency, but this need not be the case) and B = 0.25.
The log-magnitude specification is diagrammed below. Note that (20 log A) = K1 dB and
(20 log B) = K2 dB. Thus the analog filter specifications are
dB (= 20 log10 |H(jΩ)|)
0 Ω1 Ω2
Ω
K1
K2
1 = 200 rad/sec K1 = – 1 dB
2 = 600 rad/sec K2 = – 30 dB
10 1 = =
N=
2 log 1 200 200
2 log 2 log
10
10 10
2 600 600
1.2589 1
log 0.2589
log 0.2589
10
log 10 10
1000 1
= 999
= 999
=
2 log 10 600
200 200 200
2 log 600
10 2 log10 600
= log10 0.00025918 = 3.586 = 3.76 = 4
2 log 0.3333333 2 (0.47712)
10
Now, as in an earlier example, locate 8 poles uniformly on the unit circle, making sure to satisfy
all the requirements … and write down the transfer function, H (s) , of the normalized
Butterworth filter (with a cut-off frequency of 1 rad/sec),
1
s 1.848 s 1s 2 0.765 s 1
H (s) = 2
Next, determine the cutoff frequency c that corresponds to the given specifications and
the order N = 4 determined above
1 200 200 200
c = = = = = 236.8 rad/sec
2N
10 K1 /10 1 8
1.26 1 0.8446
(1) /10
1
2(4)
10
Finally, we make the substitution s (s / 236.8) in H (s) and thereby move the cutoff frequency
from 1 rad/sec to 236.8 rad/sec resulting in the transfer function Ha (s)
1
s 1.848 s 1s 2 0.765 s 1s( s / 236.8)
H a (s) = H (s) s (s / 236 .8) =2
1
/ 236.8) 1.848(s / 236.8) 1(s / 236.8)2 0.765(s / 236.8) 1
= 2
(s
(236.8)4
s 1.848(236.8) s 236.82 s 2 0.765(2326.8) s 236.82
= 2
=…
(Aside) The more general Nth order Butterworth filter has the magnitude response given by
1
H ( j) =
1 2 / 1 2 N
The parameter has to do with pass band attenuation and 1 is the pass band edge frequency
(not necessarily the same as the 3 dB cut-off frequency c). MATLAB takes = 1 in which case
1 = c. See DSP-HW. [See Cavicchi, Ramesh Babu].
(End of Aside)
Impulse-invariant design If ha(t) represents the response of an analog filter Ha(s) to a unit
impulse (t), then the unit sample response of a discrete-time filter used in an A/D – H(z) – D/A
structure is selected to be the sampled version of ha(t). That is, we are preserving the response to
an impulse. Therefore the discrete-time filter is characterized by the system function, H(z), given
by
H(z) = ʓ{h(n)} = ʓ h a (t)
t nT
If we are given an analog filter with system function Ha(s) the corresponding impulse-invariant
digital filter, H(z), is seen from above to be
H(z) = ʓ L1H a (s)t nT , where L–1 means Laplace inverse
Note that at this point we have not specified how Ha(s) was obtained, but rather we have
shown how to obtain the digital filter H(z) from any given Ha(s) using impulse invariance.
A
Example 5.3.1 [Low pass filter] For the analog filter Ha(s) = find the H(z) corresponding
s
to the impulse invariant design using a sample rate of 1/T samples/sec.
A
Solution The analog system’s impulse response is h (t) = ℒ–1 =Ae t u(t) . The
s
a
where, as previously, we have set e T = a. The discrete-time filter, then, is given by the z-
transform of h(n)
H(z) = ʓ{h(n)} = ʓ A e T u(n) =
n
Az
=
Az
z e T za
A A
= =
1 e T 1
z 1 az 1
which has a pole at z = e T = a. In effect, the pole at s = –α in the s-plane is mapped to a pole at
z = e T = a in the z-plane. (HW What is the difference equation?)
Y (z) = A → Y (z)(1 az 1) = A X (z)
X (z) 1 az 1
→ y(n) a y(n 1) = Ax(n) → y(n) = Ax(n) a y(n 1)
Relationship between the s-plane and the z-plane ( z es T ) We can extend the above procedure
to the case where Ha(s) is given as a sum of N terms with distinct poles as
N
Ak
Ha(s) =
k 1 s k
Mapping of poles, z = es T
s-plane pole z-plane pole
s = ζ + jΩ z = es T = r e j r ω
0 1 1 0
jΩs/2 –1 1 π
–∞ + jΩs/2 –0 0 π
–∞ – jΩs/2 –0 0 π
–jΩs/2 –1 1 π
For s1 = ζ1 + jΩ1 we have r = e 1 T and ω = Ω1T. However, poles at s2 and s3 (which are a
distance Ωs from s1) also will be mapped to the same pole that s1 is mapped to. In fact, an infinite
number of s-plane poles will be mapped to the same z-plane pole in a many-to-one relationship.
These frequencies differ by Ωs = 2πFs = 2π/T (Fs is the sampling frequency in Hertz). This is
called aliasing (of the poles) and is a drawback of the impulse-invariant design. The analog
system poles will not be aliased in this manner if, in the first place, they are confined to the
“primary strip” of width Ωs = 2πFs = 2π/T in the s-plane.
In a similar fashion poles located in the right half of the primary strip in the s-plane will
be mapped to the outside of the unit circle in the z-plane. Here again the mapping of the s-plane
poles to the z-plane poles is many-to-one.
jΩ
s-plane
j3π/T
Im s2
z-plane Ωs
jΩs/2 = jπ/T
s1
Ω1T Re =ζ1+jΩ1 σ Primary strip,
1 0 width = Ωs = 2π/T
s3 –jπ/T
–j3π/T
Owing to the aliasing, the impulse invariant design is suitable for the design of low pass
and band pass filters but not for high pass filters.
(Omit) Matched z-transform In this method we apply the mapping z = es T not only to the poles
but also to the zeros of Ha(s). As a result the observations made above are valid for the matched
ransform method of filter design.
Frequency response of the equivalent analog filter Going back to the impulse invariant design
of the first order filter, how does the frequency response of the A/D – H(z) – D/A structure using
this H(z) compare to the frequency response of the original system specified by Ha(s)?
Ha(j) Heq(j)
X(s) Y(s) X(s) Y(s)
Ha(s) A/D H(z) D/A
x(t) y(t) x(t) y(t)
A
Az Az
Note Ha(s) = and H(z) = = with a = eT . For the analog filter we have
s z e T
za
A A A j tan1 (/ )
Ha(jΩ) = = = e
s s j j 2 2
A
|Ha(jΩ)| = , –∞<Ω<∞
22
For future reference note that |Ha(j0)| = A / .
To obtain the equivalent frequency response of the A/D – H(z) – D/A structure one must
first find the frequency response of the discrete-time filter specified by H(z). This is given by
Ae j
H(ej) = H (z)z e j = j T , – π < ω < π (because periodic)
e e
The analog frequency response of the equivalent analog filter is then determined by replacing ω
by ΩT. Note, however, that since the digital frequency, ω, is restricted to (–π, π), the analog
frequency, Ω, is correspondingly is restricted to (–π/T, π/T). We get
Heq(jΩ) = H (e j ) T = Ae jT
T
=
T
A , ΩT < π or Ω < π/T
e jT
e 1 e e jT
Denominator =1 eT e jT =1 eT (cosT j sin T ) = (1 eT cosT ) jeT sinT
A
So Heq(jΩ) = , Ω < π/T
(1 e cos T ) jeT sin T
T
A
|Heq(jΩ)| = , Ω < π/T
2T T
1e 2e cos T
A A
Note that |Heq(j0)| = = .
1 e T 1 a
We can plot |Heq(jΩ)| and |Ha(jΩ)| for, say, = 1 and different values of T say T = 0.1
and T = 1, remembering that |Heq(jΩ)| is periodic, the basic period going from –π/T < Ω < π/T.
Ideally the two plots should be very close (in shape, over the range of frequencies of interest) but
it will be found that the smaller the value of T, the closer the two plots are. Thus T = 0.1 will
result in a closer match than T = 1. Therefore, using the impulse invariant design, good results
are obtained provided the time between samples (T) is selected small enough. What is small
enough may be difficult to assess when the Ha(s) has several poles; and when it is found, it may
be so small that implementation may be costly. In general, other transformational methods such
as the bilinear allow designs with sample rates that are less than those required by the impulse
invariant method and also allow flexibility with respect to selection of sample rate size.
|Ha(jΩ)
Ω
π 10π
|Heq(jΩ)|
For T = 1, valid for Ω < π/1
Example 3.3.2 [Impulse invariant design of 2nd order Butterworth filter] Obtain the impulse
4
invariant digital filter corresponding to the 2nd order Butterworth filter Ha(s) = 2
s 2 2s 4
with sampling time T = 1 sec.
Solution Note that we are using T = 1 sec. simply for the purpose of comparing with the bilinear
design done later with T = 1 sec. It is important to remember that in bilinear design calculations
the value of T is immaterial since it gets cancelled in the design process; but in impulse invariant
design there is no such cancellation, so the value of T is critical (the smaller, the better).
4 4
H (s) = =
a
s2 2 2s 4 s2 2 2s 2 2
2
2
= 42 22 2
2
2
=2
s 2 2 s 2 2
The expression in braces is in familiar form and can be converted to its impulse invariant digital
filter equivalent. See 3(c) in HW.
Step invariant design Here the response of the digital filter to the unit step sequence, u(n), is
chosen to be samples of the analog step response. In this way, if the analog filter has good step
response characteristics, such as small rise-time and low peak over-shoot, these characteristics
would be preserved in the digital filter. Clearly this idea of waveform invariance can be extended
to the preservation of the output wave shape for a variety of inputs.
pa(t)
(Omit) Problem Given the analog system Ha(s), let ha(t) be its impulse response and let pa(t) be
its step response. The system Ha(s) is given to be continuous-time linear time-invariant. Let also
h(n) be the unit sample response,
p(n) be the step response, and,
H(z) be the system function,
u(n) = (k)
k
where n is implicitly some positive integer. Take, for instance, n = 3; then, from the above
equation u(3) = (0) = 1, all the other terms being zero. In other words u(n) is a linear
combination of unit sample functions. And, since the response to (k) is h(k), therefore, the
response to u(n) is a linear combination of the unit sample responses h(k). That is,
n n
(b) If p(n) = pa(nT), does h(n) = ha(nT)? Since (n) = u(n) – u(n–1), the response of the
digital system, H(z), to the input (n) is
p(n) = h(k)
k
and pa(t) = ha ( ) d
t
A K K
ℒ[pa(t)] = Pa(s) = Ha (s) = = 1 + 2
s s (s ) s s
where K1 and K2 are the coefficients of the partial fraction expansion, given by
A A A
K1 = A and K2 = =–
s s 0 = s s
Therefore,
A / A / A 0 t A t
Pa(s) = – ↔ u(t) – e u(t)
s s pa (t) = e
from which we write p(n) = pa (nT ) and hence P(z) etc. Equivalently, we may reason as follows.
The correspondence between s-plane poles and z-plane poles is
1 1
↔
s 1e z T 1
Frequency-response analysis As we did in the case of the impulse-invariant design, here also
A
we can compare |Ha (j)| with |Heq(j)|. For the system Ha(s) = the frequency response is
s
A
already evaluated as |Ha(jΩ)| = . We need the frequency response, |Heq(j)|, of the
2 2
equivalent analog filter when the above H(z) is used in a A/D – H(z) – D/A structure. Start with
the above H(z) and set z = e j to get
A 1 A 1
H (e ) = H (z) j =
j
T
1 e T = 1 e T
(z e ) z e j
z e
(e j e T )
For the equivalent analog filter we get Heq(jΩ) by setting ω = ΩT in H (e j ) .
Bilinear transformation
One approach to the numerical solution of an ordinary linear constant-coefficient differential
equation is based on the application of the trapezoidal rule to the first order approximation of an
integral (or integration). Consider the following equivalent pair of equations
dy
dt
= x(t)
dy = x(t)dt
Here dy = area shown shaded and is given by
x(n) x(n 1)
y(n) – y(n–1) = T
2
where we have used the trapezoidal rule to compute the area under a curve.
x(t)
x(nT)
x((n–1)T)
t
(n–1)T nT
Taking the z transform of the above we get
T
Y(z) – z1 Y(z) = X (z)(1 z1 )
2
Rearranging terms gives
1 z 1 1
T
Y (z) = =
X (z) 2 1 z 1 2 1 z 1
1
T 1 z
Thus the continuous time system y(t) = x(t)dt represented by the following block diagrams
In other words, given the Laplace transfer function Ha(s), the corresponding digital filter is given
2(1 z1 )
by replacing s with , or
T (1 z 1 )
H(z) = Ha (s)s 2(1z1 )
1
T (1z )
This is called bilinear transformation (both numerator and denominator are first order
polynomials), also known as bilinear z-transformation (BZT).
Here again, note that at this point we have not specified how Ha(s) was obtained, but
rather we are showing how to obtain the digital filter H(z) from any given Ha(s) using bilinear
transformation.
Example 3.4.1 [LP filter] [Bilinear] Design a digital filter based on the analog system Ha(s)
A
= , using the bilinear transformation. Give the difference equation. Use T = 2 sec.
s
Solution
A
H(z) = Ha (s)s 2(1z1 )
= = A
1 2
1 z 1
( 1) ( 1)z 1
T (1z )
T 1 z 1
Example 2 [Ludeman, p. 178] Apply bilinear transformation to the 2nd order Butterworth filter
4
Ha(s) = with T = 1 sec. Obtain (1) H(z), (2) the difference equation and
s2 2 2s 4
j
(3) H (e ) .
Solution 2(1 z1 )
2 1 z
1
(1 z 1 ) 2 (1 z 1 )
1 2z 1 z 2
=
3.4142135 0.5857865 z 2
3. Frequency response
1 2e j
e j 2 N ()
H (z)z e j = =
3.4142135 0.5857865 e j 2 D()
j
Numerator = N () = 1 2e e =e j j 2
(e j 2 e j ) = e j (2 2cos )
= 2(1 cos ) e j
Denominator = D() = 3.4142135 + 0.5857865 e j 2 = A + B e j 2
= (A + B cos 2) – j B sin 2ω
B sin 2
j tan 1
AB cos2
= (A B cos 2) (B sin 2)
2 2
e
B sin 2
H (e j ) = 2(1 cos ) j tan1
AB cos2
e
So a stable analog filter, with all of its poles in the left half plane, would be transformed
into a stable digital filter with all of its poles in the unit circle. The frequency response is
evaluated on the j axis in the s-plane and on the unit circle in the z-plane. While the frequency
responses of the analog filter and digital filter have the same amplitudes there is a nonlinear
relationship between corresponding digital and analog frequencies.
jΩ
Im
z-plane
s-plane, Unit circle
s = ζ+jΩ
j1 (for Ω = 2/T)
j0 + (Ω = 0 )
ζ Re
–
j0
(Ω = 0–)
–j2/T (Ω = –∞)
–j1 (for Ω = –2/T)
Nonlinear relationship of frequencies in bilinear transformation
In the bilinear transformation the 1analog and digital frequencies are non-linearly related. Setting
2 1 z
s = jΩ and z = e j in s = , we get
1
T 1z
j
2 1 e
j / 2 j / 2 j / 2
2(
2 j / 2 j / 2
) / 2
jΩ = = 2 e (e e ) j e e j
=
T 1 e j T e j / 2 (e j / 2 e j / 2 ) T 2(e j / 2 e j / 2 ) / 2
or 2 2
Ω= sin / 2 tan or ω = 2 tan
= 1 T
T cos / 2 T
2 2
Ω(the analog frequency) as a function of ω (the digital frequency) as
First we sketch
2
given by Ω = tan to show qualitatively the distortion of the frequency scale that occurs
T 2
due to the nonlinear nature of the relationship.
2
Ω = tan( / 2)
T
Unequal
Equally spaced pass bands A are pushed together or warped on the higher frequency end
of the digital frequency scale. This effect is normally compensated for by pre-warping the analog
filter before applying bilinear transformation.
Because of warping the relationship between Ω1 and Ω2 on the one hand and ω1 and ω2 on
the other is not linear. The digital frequencies ω1 and ω2 are pushed in towards the origin (ω = 0).
In this process Ω = is transformed to ω =.
ω
2π
ω = 2 tan1 T / 2
π (Periodic)
π
ω2
ω1
Ω |H(ω)|
0 K2 K1
–π
|H(Ω)|
(Nonperiodic)
K1
K2
Ω
Ω1 Ω2
If the bilinear transformation is applied to the system Ha(s) with critical frequency c, the
digital filter will have a critical frequency ωc = 2 tan1 c T / 2. If the resulting H(z) is used in an
A/D–H(z)–D/A structure, the equivalent critical frequency (of the equivalent analog filter) is
obtained by replacing ωc with ceqT:
1 cT 2 1 cT
ωc Ωceq T = 2 tan or Ωceq = tan
2 T 2
If (cT/2) is so small that tan1 cT / 2 cT/2, then we have
2 cT
ceq = = c
T 2
If this condition is not satisfied, then the warping of the critical frequency (in the bilinear
design) is compensated for by pre-warping.
Transition
band
|H(jΩ)|
Pass Stop
band band
A = 0.707
B = 0.25
Ω, rad./sec.
Ω1 Ω2
arbitrarily taken A = 0.707 (thus Ω1 is the cut-off frequency, but this need not be the case) and B
= 0.25.
The log-magnitude specification is diagrammed below. Note that (20 log A) = K1 and (20
log B) = K2. Thus the analog filter specifications are
dB (= 20 log10 |H(jΩ)|)
0 Ω1 Ω2
Ω
K1
K2
Example 3.6.1 Design and realize a digital low pass filter using the bilinear transformation
method to satisfy the following characteristics:
dB (= 20 log10 |H(jω)|)
0 π/2 3π/4 π
ω
–3.01
–15
Note that the given frequencies are digital frequencies. The required frequency response
is shown. We use bilinear transformation on an analog prototype.
Step 1 Pre-warp the critical digital frequencies 1 = 0.5 and 2 = 0.75 using T = 1 sec. That
is, we find the analog frequencies 1 and 2 that correspond to 1 and 2:
2 1 0.5
1 = tan = 2 tan = 2.0 rad / sec
T 2 2
2 2 0.75
2 = tan = 2 tan = 4.8284 rad / sec
T 2 2
Step 2 Design LP analog filter with critical frequencies 1 and 2 that satisfy
The Butterworth filter satisfies the monotonic property and has an order N and critical
frequency Ωc determined by Eq. 3.16 and 3.17 of Ludeman
10 K1 /10 1
log10 K 2/10
10 1 1
N= and Ωc = 2 N K /10
2 log10 1 10 1 1
2
Plugging in numerical values,
103.01/10 1 2 1
log10 15/10 log10
10 1 31.62 1 1.486 = 1.941 = 2
N= 2 = 2 0.3827 = (0.3827)
2 log10 2
4.828
2.0 2
Ωc = = = 2 rad / sec
4
10 3.01/10
1
4
2 1
Note in this case that Ωc = Ω1.
Therefore, the required pre-warped, normalized, unit bandwidth, analog filter of order 2
using the Butterworth Table 3.1b (or the Butterworth circle) is
1
Ha(s) = (with a cut off frequency = 1 rad / sec)
s2 2 s 1
Since we need a cut-off frequency of Ωc = 2 rad/sec, we next use the low pass to low pass
transformation s → s/2 in order to move the cut-off frequency from 1 to 2 rad/sec.
1 1
H (s) =
a =
s2 2 s 1ss / 2 (s / 2)2 2(s / 2) 1
4 (with a cut-off frequency = 2 rad/sec.)
= 2
s 2 2 s 4
Step 3 Applying the bilinear transformation to Ha(s) with T = 1 will transform the pre-warped
analog filter into a digital filter with system function H(z) that will satisfy the given digital
requirements:
H(z) = Ha (s)s2(1z1 ) =
4
1z1
1
2(1 z ) 2 2(1 z 1 )
2
4
1 2
1 z 1 z 1
1 2
1 2 z z
=
3.414 0.585 z 2
HW: Obtain the difference equation. Plot | H (e j ) | and H (e j ) vs .
As the T in the Ωi equation and the T in the bilinear transform cancel in the procedure described
above for low pass filter design, it is convenient to just use T = 1 in both places. This is easily
seen since if the Ωi comes from an analog-to-analog transformation of an Ha(s) with a unit radian
2(1 z 1 )
cut-off frequency, we have s→(s/ Ωi), and when the bilinear transformation s → is
T (1 z 1 )
used the cascade of transformations is given by
2(1 z 1 ) = 2(1 z 1 )
2
1
(1 1 z ) i
s → T (1 z 1 )i 1
T (1 z ) tan i = (1 z ) tan
2
T 2
This does not contain a T. Thus it is immaterial what value of T is used as long as it is the same
in both steps (which it is).
The procedure for the design of a digital filter using the bilinear transformation consists
of:
Step 1: Pre-warping the digital specifications
Step 2: Designing an analog filter to meet the pre-warped specs
Step 3: Applying the bilinear transformation
In the process T is arbitrarily set to 1, but it can be set equal to any value (e.g., T = 2), since it
cancels in the design. The design process is shown by the figure below.
Design
Pre-warp Pre-warped Analog
Digital specs
T=1 Filter
ω1, ω2 , …, ωN Analog specs Ha(s)
K1, K2, …, KN Ωi = (2/T) tan (ωi/2) Ω1, Ω2, …, ΩN
K1, K2, …, KN Bilinear
transformation T = 1
2 1 z 1
s
T 1 z1
Desired
H(z)
Example 3.6.2 Design a digital low pass filter with pass band magnitude characteristic that is
constant to within 0.75 dB for frequencies below = 0.2613 and stop band attenuation of at
least 20 dB for frequencies between = 0.41 and .
dB (= 20 log10 |H(jω)|)
0 0.2613π 0.41π π
ω
–0.75
–20
Use bilinear transformation. Determine the transfer function H(z) for the lowest order
Butterworth design which meets these specifications. Draw the cascade form realization.
1 1 2 2 3 3
Since Ωc = 1 the LP to LP transformation s → (s/1) results in the same Ha(s) as given above.
Step 3: H(z) = Ha (s)s2(1z1 )
1z1
1 1 1
s s 1s s s 2(1z s s 2s s s 2(1z s s 3s s3*s 2(1z
= * *
1 1 1
1 ) 2 ) )
1 1
1 z 1 z 1 z1
Example 3.6.3 Determine H(z) for a Butterworth filter satisfying the following
constraints. Use the impulse invariance technique.
0.5 | H (e j ) | 1, for 0 ω π /2
| H (e j ) | 0.2, for 3π /4 ω π
|H(ω)
|
1
0.707
0.2
ω
0 π/2 3π/4 π
dB (= 20 log10 |H(ω)|)
π/2 3π/4 π
0 ω
–3
–13.98
Solution The critical frequencies are ω1 = π/2, ω2 = 3 π/4. Use ω = ΩT to determine the analog
frequencies 1 and 2. Note T is not given. Take T = 1, so that ω = Ω .1 = Ω. (This corresponds
to the pre-warping step of the bilinear transformation with Ω = (2 /T ) tan( / 2) ).
We have ω = Ω .1, so that the critical frequencies are
K1 = –3.01 dB
1 = ω1 = π/2 rad/sec. (= ωc)
K2 = – 13.98 dB
2 = ω2 = 3π/4 rad/sec.
to get H(z) from the Ha(s). Once we get the Ha(s) we can then combine complex conjugate pole
pairs to biquadratic form and then implement as a parallel form with two biquadratics in it.
Alternatively, memorize relations 3(c) and 3(d). This latter gives the biquadratics directly.
This same problem will next be solved using the bilinear transformation to show the
difference.
Step 1: Pre-warping according to Ω = tan with T = 1 gives
2
T 2
1 ( / 2)
Ω1 = 2 tan = 2 tan = 2 rad / sec
2 2
2 (3 / 4)
Ω2 = 2 tan = 2 tan = 4.828 rad / sec
2 2
Step 2: Design Ha(s)
103.01/10 1
log10 13.98/10
10 1
N= 2 =?
2log10
4.828
Ωc = 1
=?
K1 /10
2N
10 1
Step 3: H(z) = Ha (s)s2(1z1 )
1
1z
Example 3.6.4 Design a low pass digital filter by applying impulse invariance to an appropriate
Butterworth continuous-time filter. The digital filter specs are:
0 0.2π 0.3π π
ω
K1 = –1 dB
K2 = –15 dB
1 1 2 2 3 3
Since Ωc = 0.703 the LP to LP transformation s → (s/0.703) results in
1
s s 1s s 1 s s 2s s 2* s s3 s s3*s
Ha(s) = *
s
0.703
To be completed
Example 3.6.5 [2003] [The Butterworth circle and the bilinear transformation] Refer to
Oppenheim & Schafer, Sec. 5.1.3 and Sec. 5.2.1. The bilinear transformation is given by
2 (1 z 1 )
s= 1 (sT / 2)
or z=
T (1 z 1 ) 1 (sT / 2)
This last equation is used to map the poles on the Butterworth circle in the s-plane into poles on
the Butterworth circle in the z-plane. For the normalized Butterworth filter with a cut-off
frequency of 1 rad/sec., the Butterworth circle in the s-plane has unit radius. If the cut-off
frequency is Ωc instead of 1, then the circle has a radius of Ωc. This is the case in the example on
pp. 212-214 of Oppenheim & Schafer where the order N of the filter is 3, the radius of the
Butterworth circle in the s-plane is Ωc, and ΩcT = ½ which corresponds to a sampling frequency
of twice the cut-off frequency (Figure 5.14).
For the two poles at s = – Ωc and s = Ωc and ΩcT = ½ we get
1 (cT / 2) = 1 (1/ 4) = 3/5
s = – Ωc : z=
1 (cT / 2) 1 (1/ 4)
1 (cT / 2) 1 (1/ 4) = 5/3
s = Ωc : z= =
1 (cT / 2) 1 (1/ 4)
Both of these z-plane poles are on the real axis as shown in figure below.
jΩ Im
Unit circle z-plane
jΩc j1
s-plane 3/5
ζ –1 Re
Ωc 5/3
Radius = Ωc
Butterworth circle
Butterworth circle in the z-plane
in the s-plane
The other s-plane poles are similarly mapped to z-plane poles, though the algebra involved is a
little more. Note that the three poles in the left-half of the s-plane are mapped into the inside of
the unit circle in the z-plane.
Example 5.7.1 [Bilinear] [4.2, p. 180, Ludeman] Design a digital filter H(z) that when used in
an A/D-H(z)-D/A structure gives an equivalent low-pass analog filter with (a) –3.01 dB cut-off
frequency of 500Hz, (b) monotonic stop and pass bands, (c) magnitude of frequency response
down at least 15 dB at 750 Hz, and (d) sample rate of 2000 samples/sec.
Solution
Step 0 First we convert the analog Ω’s to digital ω’s using i = iT.
Thus
1
ω1 = Ω1T = 1000 = 0.5 rad, K1 = –3.01 dB
2000
1
ω2 = Ω2T = 1500 = 0.75 rad, K2 = –15 dB
2000
Step 1 Pre-warping. Use T = 1. (In Steps 1 and 3 we could have used T = 1/2000 but the two
occurrences of T would cancel out).
2 1 2 2
1 = tan = 2.0 rad/sec. and = tan = 4.828 rad/sec.
2
T 2 T 2
Step 2 Design Ha(s), i.e., determine the low pass Butterworth filter (see earlier example).
103.01/10 1 log10 2 1
log10 15/10
10 1 31.62 1 1.486 = 1.941 = 2
N= 2 = 2 0.3827 = (0.3827)
2 log 10 2
4.828
2.0 2
Ωc = = = 2 rad / sec
4
10 3.01/10
1
4
2 1
Do analog low pass to low pass transformation s→(s/Ωc), i.e., s→(s/2) in order to move the cut-
off frequency from 1 to 2 rad/sec. This gives the Ha(s) with pre-warped specs and Ωc = 2 rad/sec.
1 1
H (s) =
a =
s2 2 s 1 ss / 2 (s / 2)2 2(s / 2) 1
4
= 2 (with a cut-off frequency = 2 rad/sec.)
s 2 2s4
2
Step 3 Applying the bilinear transformation s→ (1 z 1 ) to H (s) with T = 1 will transform
a
T (1 z 1 )
the pre-warped analog filter into a digital filter with system function H(z) that will satisfy the
given requirements:
1 2z z 2
4 1 2
H(z) = Ha (s) s 2(1z1 ) = 2 =
(1 z1 ) 2(1 z 1 ) 2 2(1 z 1 ) 4 3.414 0.585z
2
1 z 1 1 z 1
Example 3.7.2 [2002] Derive the Butterworth digital filter having the following specs:
dB (= 20 log10 |H|)
0 0.221 1.299 π
ω
–1 dB
–60 dB
Solution Even though pass band ripple may suggest a Chebyshev filter we shall comply with the
request for a Butterworth filter. We use bilinear transformation.
Analog frequency specs are given. Convert them to digital by using the relation ω = ΩT
and T = (1/20000) sec.
Now, starting from these digital specs the design proceeds in 3 steps as usual.
Step 1 Pre-warp the critical digital frequencies 1 and 2 using T = 1 sec., to get
2 1 0.221
1 = tan = 2 tan = 2 tan0.11 = 0.221 rad/sec.
T 2 2
2 2 1.299
2 = tan = 2 tan = 2 tan 0.650 = 1.519 rad/sec.
T 2 2
Step 2 Design an analog low pass filter with critical frequencies 1 and 2 to satisfy
The Butterworth filter of order N and cut-off frequency Ωc is given by equations (3.16) and
(3.17) of Ludeman:
10 K1 /10 1 101/10 1 1.259 1
log10 K 2/10 log10
log 10
60/10 6
10 1 = 10 1 10 1
N=
2 log 1
0.221 = 2 log 0.145
10 2 log 10 10
2 1.519
log 2.59 . 10
7
6.587
= 10 = 3.934 = 4
2 0.837 1.674
=
1 0.221 0.221
Ωc = = =8
0.221
= 0.845 = 0.262 rad/sec.
101/10 1 1.259 1
2N
10 K1 /10 1 8
Therefore the required pre-warped Butterworth (analog) filter using Table 3.1b (Ludeman) and
the analog low-pass to low pass transformation from Table 3.2, s→(s/Ωc), that is, s→(s/0.262), is
1
Ha(s) = 4
s 2.613 s3 3.414 s2 2.613 s 1 s ( s / 0.262)
Example 3.7.3 Design a digital LPF using bilinear transformation with the following
specifications, and a Butterworth approximation:
– 2 dB at 5 rad/sec.,
– 23 dB at 10 rad/sec.,
Sampling frequency = 1000 per sec.
dB (= 20 log10 |H|)
0 0.005 0.01
ω
K1 = –2
K2 = –23
Solution Convert the analog specs to digital using = ΩT, with T = 1/1000 sec. The critical
frequencies are
ω1 = Ω1T = 5/1000 = 0.005 rad; K1 = –2 dB
ω2 = Ω2T = 10/1000 = 0.01rad; K2 = –23 dB
Example 5.7.4 [2003] Design a digital filter that will pass a 1 Hz signal with attenuation less
than 2 dB and suppress 4 Hz signal down to at least 42 dB from the magnitude of the 1 Hz
signal.
dB (= 20 log10 |H|)
0 2π 8π
Ω
K1 = –2
42 dB
K2 = –44
Solution All the specs are given in the analog domain. The sampling period T is not specified.
Since 1 Hz is in the pass band and 4 Hz in the stop band we shall use some multiple of 4 Hz, say,
20 Hz as the sampling frequency. Thus T = 1/20. We shall employ the impulse invariance
method.
so that ω1 = 2T = 2 (1/20) = 0.1 rad., and ω2 = 8T = 8 (1/20) = 0.4 π rad.
Step 1 Convert the digital frequencies 1 and 2 back to analog frequencies. Since we are using
impulse invariance this involves using the same formula ω = ΩT and we get the same analog
frequencies as before, viz., Ω1 = 2 rad/sec., and Ω2 = 8 rad/sec. (Note that the value of T is
irrelevant up to this point. We could have used a value of T = 1 in Steps 0 and 1, resulting in
awkward values for the ω’s, like 2 and 8 when we expect values between 0 and ; but this is
not a problem for the design).
Alternatively, we can get the individual pole locations from the Butterworth circle.
1
Ha(s) =
(s 0.924 j0.383)(s 0.924 j0.383)(s 0.383 j0.924)(s 0.383 j0.924)
* *
A A + C C
= + +
s s1 s s1 s s2 s s2
* *
Determine A, A*, C and C*. Next find H (s) which is the analog prototype. From this we
a s (s / c )
can find the H(z) by mapping the s-plane poles to z–plane poles by the relation: (s = s1) → (z =
e s1T ). Here at last we must specify T; we could use T = 1/20. In general, the smaller the value of T
the better.
z z z z *
Ha(z) = A z e s1T + A* z s *T + C z e s2T + C* sT
e1 ze2
If we were to use the bilinear transformation use some value of T like 1/20 (justifying it
on the basis of the sampling theorem) in ω = ΩT in Step 0.
Example 5.7.5 [Low pass filter] Design a digital low pass filter to approximate the following
transfer function:
1
H (s) =
a
s2 2 s 1
Using the BZT (Bilinear z-transform) method obtain the transfer function, H(z), of the digital
filter, assuming a 3 dB cut-off frequency of 150 Hz and a sampling frequency of 1.28 kHz.
Solution This problem is a slight variation from the pattern we have followed so far in that it
specifies one critical frequency (cut-off frequency) and the filter order instead of two critical
frequencies with the filter order unknown.
Step 0 Convert the analog specs to digital
0.7715 0.7715
Step 3 Applying the BZT (with T = 1)
H(z) = Ha (s) s2(1z1 ) =
1
2
T (1 z1 )
2(1
1
z ) 2(1 z ) 1
1
2
(1 z ) 0.7715 (1 z ) 0.7715
1 1
=
41 z 1 (0.91901)(2) 1 z 1 1 z 1 0.422291 z 1
2 2
The denominator is
Dr = 41 2z1 z2 1.838021 z2 0.422291 2z1 z2
Dr = (4 1.83802 0.42229) z1 (8 0.84458) z2 (4 1.83802 0.42229)
Dr = 6.26031 7.15542 z1 2.58427 z2
0.42229(1 2z 1 z 2 )
H(z) =
6.26031 7.15542 z 1 2.58427 z 2
0.06746(1 2z 1 z 2 )
=
6.260311.14298 z 1 0.4128 z 2
Frequency Transformation
Frequency transformation is useful for converting a frequency-selective filter from one type to
another.
1. Low-pass to low-pass transformation Given the prototype low pass filter G(s) with unit
band width (i.e., cut-off frequency = 1 rad/sec.) and unity gain at = 0 (i.e., |G(j0)| = 1), the
transformation s → s/c gives us a new filter, H(s), with cut-off frequency of c. The filter H(s)
is given by
H(s) = G(s)s s / c
The critical frequency Ωr of the filter G(s) is transformed to r of the filter H(s), given by
r = Ωr Ωc. Both G(s) and H(s) are low pass filters.
20 log10 |G(jΩ)|
0 dB
K1
K2
Ω
0 1 Ωr
20 log10 |H(jΩ)|
0 dB
K1
K2
Ω
0 Ωc r
20 log10 |H(jΩ)|
0 dB
K1
K2
Ω
0 r Ωc
There are similar transformations from low-pass to band-pass and low-pass to band-stop.
Refer to table 3.2, page 128, Ludeman.
The Low-pass prototype analog unit bandwidth filter could be any analog filter such as
Butterworth, Chebyshev etc. of any order, any ripple etc.
Type I (Chebyshev I) is an all-pole filter. It has equiripple behavior in the pass band and
monotonically decreases in the stop band. For N = order of the filter, the magnitude response
looks as below (N = 5 and N = 6 illustrated). The magnitude, |H(jΩ)|, is an even symmetric
function of Ω.
|H(jΩ)| |H(jΩ)|
N is odd N is even
1
1
N=5
N=6
A A
B B
Ω Ω
0 Ω2 0 Ω1 Ω2
Type II (Chebyshev II or Inverse Chebyshev) filter has both poles and zeros. It has a
monotonically decreasing shape in the pass band and an equiripple behavior in the stop band.
|H(jΩ)|
0
Ω
Design of the Chebyshev I filter A typical magnitude response specification is sketched below
(shown for N = 5 and N = 6). The magnitudes at the critical frequencies Ω1 and Ω2 are A and B,
respectively. Typically Ω1 is in the pass band or is the edge of the pass band and Ω2 is in the stop
band or is the edge of the stop band. In terms of the log-magnitude the analog filter specifications
are as below. Note that (20 log A) = K1 dB and (20 log B) = K2 dB. If A and B are less than 1, K1
and K2 are negative.
|H(jΩ)| |H(jΩ)|
N is odd N is even
1
1
N=5
N=6
A A
B B
Ω Ω
0 Ω1 Ω2 0 Ω1 Ω2
[Aside If the frequencies are normalized, that is, for a normalized filter, Ω1 = 1 rad/sec and the
magnitude characteristic of the Nth order Chebyshev I filter is given by
1
|H(jΩ)| = , N = 1, 2, …
1 2 C2N
End of Aside]
At Ω = 0 we have
CN(0) = cosN cos1 0 = cosN / 2
= 0, N odd
±1, N even
As a consequence, on the vertical axis (Ω = 0) the magnitude curve starts at |H(j0)| = 1 for odd N
1
and at |H(j0)| = A = for even N.
1 2
At Ω = Ω1 we have CN(1) = cosN cos1 1 = cos0 = 1 for all N. The corresponding
magnitude is
1
|H(jΩ1)| = A = , for all N
1 2
10 K 1
1 /10
N=
cosh1 2
1
The symbol means that the computed result is rounded to the next larger integer. For
example, if N = 3.2 by the above calculation then it is rounded up to 4, and the order of the
required filter is N = 4. In such a case the resulting filter would exceed the specification at both
Ω1 and Ω2.
Example 3.9.1 [Filter order] Determine the order of a Chebyshev I filter to have an attenuation
of no more than 1 dB for |Ω| ≤ 1000 rad/sec and at least 10 dB for |Ω| ≥ 5000 rad/sec.
= 1
= = 1.073 = 2
cosh 5 2.2924
[On the HP 15C, cosh1 5.8956 is obtained by: (1) Enter Radian mode, (2) Enter 5.8956, (3) g,
(4) HYP1 , and (5) COS]
Pole locations and transfer function The poles of the Chebyshev I filter are related to those of
the Butterworth filter of the same order and are located on an ellipse in the s-plane. If N is odd
there will be a pole on the negative real axis. In order to find the pole locations and hence the
transfer function we introduce the parameter β
1
β = sinh1 1/
N
The poles of H(s), sksin jΩk, k =
=ζk2k+1 0, 1,
sinh … ,and
(N–1), Ω
are=given 2k 1
cos by cosh
ζk =
k
N 2 N 2
jΩ
cosh β
j1
sinh β
ζ
–j1
Note that if the sinh and cosh terms were not present we would have the pole locations of
the normalized Butterworth filter
(on and
the unit circle), that is,
sin
2k 1 Ω = cos 2k 1
ζk = k
N 2 N 2
with 2 2 = 1 which is the unit circle. Thus, the hyperbolic sine and cosine terms are scale
k k
factors which, when applied to the Butterworth pole coordinates, give the pole coordinates of a
Chebyshev I filter of the same order. The Chebyshev poles are located on an ellipse in the s-
plane described by
k2 2k = 1
+
sinh 2 cosh2
The major axis of the ellipse is on the imaginary (jΩ) axis and the minor axis is on the real axis
and the foci are at Ω = ±1. The 3 dB cut-off frequency occurs at the point where the ellipse
intersects the jΩ axis, that is, at Ω = cosh .
In putting together the transfer function, H(s), we rely on the symmetry of pole positions
and make use of the left half plane poles only. Finally, the pole positions are scaled by the actual
“cut-off frequency” Ω1. This last step amounts to s→ s/Ω1 (in the case of the Butterworth design
this was s→ s/Ωc).
Example 3.9.2 [Pole locations and transfer function] Find the pole locations and the transfer
function of the Chebyshev I filter designed in above example, that is, with an attenuation of no
more than 1 dB for |Ω| ≤ 1000 rad/sec and at least 10 dB for |Ω| ≥ 5000 rad/sec.
Solution The filter order has been determined above as N = 2. Further, we know that |H(jΩ1)| =
1 1 2 and 20 log H ( j 1) = –1 dB. Thus
20 log 1 1 2 = –1
Solving for we get = 0.5088. Since N is even |H(j0)| = 1 1 2 = 0.8913 is the starting point
on the vertical axis.
With regard to the pole locations, if it were a Butterworth filter of order 2 the poles are
located at 2k 1
2k 1 and Ω = cos , k = 0, 1
sin
ζk = k
N 2 N 2
s0,1 = sin ± j cos
= 1 2 ± j 1 2
4 4
The Chebyshev I poles are then obtained from the Butterworth poles by scaling the real and
imaginary parts, respectively, by sinh and cosh and then scaling both parts by Ω1:
s0,1 = 1 1 2 sinh j 1 2 cosh
where Ω1 = 1000 rad/sec., and
1 1
β = sinh1 1/ = sinh1 1/ 0.5088 = 0.7140
N 2
Thus the Chebyshev I pole locations are
1000 1000
s0,1 = sinh 0.714 2 ± j cosh 0.714
2
1000 1000
= sinh 0.714 ± j cosh 0.714
2 2
= – (707.11) (0.7762) ± j (707.11) (1.2659) = –548.86 ± j 895.15
Hence
K K
H(s) = =
(s s0 )(s s1 ) (s (548.86 j895.15))(s (548.86 j895.15))
K
=
(s 548.86)2 (895.15)2
Since N is even the constant K will be adjusted to achieve |H(j0)| = 1 1 2 = 0.8913. (If N
were odd, K would be adjusted to achieve |H(j0)| = 1.)
K
|H(j0)| = = 0.8913
(548.86)2 (895.15)2
which yields K = 982694.6. The filter then is
982694.6
H(s) =
(s 548.86)2 (895.15)2
Example 3.9.3 [Ramesh Babu] Determine the order of a Chebyshev I filter to have a gain of –3
dB or better for |F| ≤ 1000 Hz and a gain of –16 dB or less for |F| ≥ 2000 Hz. Find the pole
locations and the transfer function.
Solution The specifications as given are
1
= 19739005.5 2
s 4043.8s 27915169.3
Design of the Chebyshev II filter A typical magnitude response specification is sketched below.
The magnitudes at the critical frequencies Ω1 and Ω2 are A and B, respectively. Typically Ω1 is in
the pass band or is the edge of the pass band and Ω2 is in the stop band or is the edge of the stop
band. In terms of the log-magnitude the analog filter specifications are as below. Note that (20
log A) = K1 dB and (20 log B) = K2 dB. If A and B are less than 1, K1 and K2 are negative.
|H(jΩ)|
1
A
0 Ω
Ω1 Ω2
1 2 N2 2 1
C N (2 / 1 )
At Ω = 0, CN (2 / ) = CN () → ∞, and the magnitude becomes
1
|H(j0)| = =1 for all N
2
CN ( 2 / 1 )
1 2
C N2 (2 / 0)
The magnitude curve starts at |H(j0)| = 1 on the vertical axis for all N.
At Ω = Ω2 we have CN (2 / 2 ) = CN (1) = cosN cos 11 = cos0 = 1
1 1
|H(jΩ2)| = =
2 2
2 CN (2 / 1 ) 2 CN (2 / 1 )
1 1
CN2 (2 / 2 ) 1
1
= = B, for all N
1 2C N2 ( 2 / 1)
The order, N, of the filter is given by
cosh1 10 2 1
K /10
N=
10 1
K1 /10
cosh1 2
1
The symbol means that the computed result is rounded to the next larger integer. For
example, if N = 3.2 by the above calculation then it is rounded up to 4, and the order of the
required filter is N = 4. In such a case the resulting filter would exceed the specification at both
Ω1 and Ω2.
Example 3.9.4 If an analog low pass filter is to have an attenuation of 1 dB at cut-off frequency
of 1 kHz, and a maximum stop band ripple of 0.01 for |F| > 5 kHz, determine the required the
filter order for (a) a Butterworth filter, (b) a Chebyshev I filter, and (c) a Chebyshev II filter.
Solution The specifications are the same for all three cases but the magnitude characteristic
differs from one case to the next.
(a) The Butterworth magnitude (absolute value) characteristic is sketched below.
|Ha(jΩ)|
1
A =0.8912
B = 0.01
Ω, rad./sec.
Ω1= 2π1000 Ω2= 2π5000
The relation between the absolute values and the dB figures (K1 = 20 log A and K2 = 20 log B) is
used to compute A = 10K1 / 20 = 101/ 20 = 0.8912 and K2 = 20 log B = 20 log 0.01 = –40 dB.
The Butterworth filter order is given by
10 K1 /10 1 100.1 1
10 (1) /10
1
log10 K 2/10 log10 10 (40) /10 1 log10 10 4 1
10 1 = =
N=
2 log 1
1 1
2 log10
10
2 log10
2 5 5
1.25892 1
log 4.5868
10
10000 1 = 3.28 = 4
= =
2 log10 0.2 1.3979
(b) The Chebyshev I specs and magnitude (absolute value) characteristic are diagrammed below.
As earlier we compute A = 10 K1 / 20 = 101/ 20 = 0.8912 and K2 = 20 log B = 20 log 0.01 = –40 dB.
|H(jΩ)| |H(jΩ)|
N is odd N is even
1
1
N =?
N =?
A A
B B
Ω Ω
0 Ω1 Ω2 0 Ω1 Ω2
= = = 2.2924 = 2.6059 = 3
cosh 5 cosh 5
1 1
(c) The Chebyshev II specs and magnitude (absolute value) characteristic are shown below. As
earlier we compute A = 10 K1 / 20 = 101/ 20 = 0.8912 and K2 = 20 log B = 20 log 0.01 = –40 dB.
|H(jΩ)|
1
A
0 Ω
Ω1 Ω2
= = = 2.2924 = 2.6059 = 3
cosh 5 cosh 5
1 1
Example 3.9.5 Determine the system function H(z) of the lowest order Chebyshev filter that
meets the following specs. Use the impulse invariance method.
(a) 0.5 dB ripple in the pass band, 0 ≤ |ω| ≤ 0.24π
(b) At least 50 db attenuation in the stop band, 0.35π ≤ |ω| ≤ π
Solution We assume the Chebyshev I filter. The procedure is similar for the Chebyshev II. The
specs are:
The sampling time, T, is not specified. Since this is impulse invariant design, T should be very
small – the smaller the better. Strictly for convenience we shall use T = 1 sec., and convert the
digital specs to analog using the relation ω= ΩT.
N = unknown
|H(jΩ)| (Shown for N = 5)
1
A = 10 K1 / 20
B = 10 K2 / 20
Ω
0 Ω1 = Ω2 =
0.24 0.35
The Chebyshev I filter order is given by
K 2 /10
1 (50) /10
1 100000 1
cosh1 10 cosh1 10 cosh1
10 K1 /10 1 10(0.5) /10 1 = 10 0.05
1
N= 2 = 1 0.35 cosh1 1.4583
cosh cosh
1
1 0.24
= cosh 1819539.96= cosh1 (905.28) = 7.5014
1 1
|H(jΩ)|2 |H(jΩ)|2
N is odd N is even
1
1
N=5
N=6
1/(1+ε2) 1/(1+ε2)
0 0 Ω
Ω Ωc
Ωc
Digital Signal Processing – 4
Contents:
FIR – Recapitulation
Characteristics if FIR digital filters
Frequency response
Design of FIR digital filters – The Fourier series and windowing method
Choosing between FIR and IIR filters
Relationship of the DFT to the z-transform
FIR - Recapitulation
Nomenclature With a0 = 1 in the linear constant coefficient difference equation,
a0 y(n) + a1 y(n–1) + … + aN y(n–N)
= b0 x(n) + b1 x(n–1) + … + bM x(n–M), a0 0
we have,
M
H(z) =
b z
i0
i i
1 ai z i
i 1
This represents an IIR filter if at least one of a1 through aN is nonzero, and all the roots of the
denominator are not canceled exactly by the roots of the numerator. In general, there are M finite
zeros and N finite poles. There is no restriction that M should be less than or greater than or equal
to N. In most cases, especially digital filters derived from analog designs, M ≤ N. Systems of this
type are called Nth order systems. This is the case with IIR filter design.
When M > N, the order of the system is no longer unambiguous. In this case, H(z) may be
taken to be an Nth order system in cascade with an FIR filter of order (M – N).
When N = 0, as in the case of an FIR filter, according to our convention the order is 0.
However, it is more meaningful in such a case to focus on M and call the filter an FIR filter of M
stages or (M+1) coefficients.
Example The system H(z) = (1 z8 ) (1 z1 ) is an FIR filter. Why (verify)?
An FIR filter then has only the “b” coefficients and all the “a” coefficients (except a0
which equals 1) are zero. An example is the three-term moving average filter y(n) = (1/3) x(n) +
(1/3) x(n–1) + (1/3)x(n–2). In general the difference equation of an FIR filter can be written
M
There are (M + 1) coefficients; some use only M coefficients. This equation describes a
nonrecursive implementation. Its impulse response h(n) is made up of the coefficients {br} =
{b0, b1, …, bM}
Equivalently, the finite length impulse response can also be written in the form of a weighted
sum of functions as was done in Unit I for example, x(n)
x(k) (n k)
k
M
The difference equation (1) is also equivalent to a direct convolution of the input and the
impulse response:
M M
where we have written br as b(r), i.e., the subscript in br is written as an index in b(r).
The transfer function H(z) of the FIR filter can be obtained either from the difference
equation or from the impulse response h(n):
H(z) = h(n)z
M n
= b b z1 b z2 ... b z M
0 1 2 M
n0
b z M b z M 1 ... b z1 b
0 1 M 1 M
=
b
M
b z b
b z M 1 z M 1 .... M 1 z1 M
0 b b
b
= 0 0 0
M
z
The transfer function has M nontrivial zeros and an Mth order (trivial) pole at z = 0. This is
considered as an all-zero system.
We may obtain the frequency response H (e j ) or H() of the FIR filter either from H(z)
as
H (e j ) = H (z) j
z e
or, from the impulsejresponse, h(n), jasn the discrete-time Fourier transform (DTFT) of h(n):
H (e ) = h(n) e = M j n b e j b e j 2 ... b e jM
b e =b
n 0 1 2 M
n n0
1
Magnitude
Magnitude of H()
0.5
0
-4 -3 -2 -1 0 1 2 3 4
Frequency , rad/sample
4
Phase
2
Phase of H()
-2
-4
-4 -3 -2 -1 0 1 2 3 4
Frequency , rad/sample
Normalized frequency We define the r = ω/π. As ω goes from – to the variable r goes from
–1 to 1. This corresponds to a frequency range of –Fs/2 to Fs/2 Hz. In terms of the normalized
frequency the frequency response of the three-term moving average filter becomes
1 e j r e j 2 r
H(r) =
3
Magnitude of H(r)
0.5
0
-1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1
Normalized frequency, r
4
Phase
2
Phase of H(r)
-2
-4
-1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1
Normalized frequency
We illustrate below the characteristics of several types of FIR filter. The filter length N
may be an odd (preferred) or an even number. Further, we are typically interested in linear phase.
This requires the impulse response to have either even or odd symmetry about its center.
Example 4.2.1 Find the frequency response of the following FIR filters
A. h(n) = {0.25, 0.5, 0.25} Even symmetry
B. h(n) = {0.5, 0.3, 0.2} No symmetry
C. h(n) = {0.25, 0.5, –0.25} No symmetry
D. h(n) = {0.25, 0, –0.25} Odd symmetry
Solution
(A) The sequence h(n) = {0.25, 0.5, 0.25} has even symmetry.
1
Magnitude
Magnitude of H()
0.5
0
-4 -3 -2 -1 0 1 2 3 4
Frequency , rad/sample
4
Phase = -
2
Phase of H()
-2
-4
-4 -3 -2 -1 0 1 2 3 4
Frequency , rad/sample
(B) The sequence h(n) = {0.5, 0.3, 0.2}is not symmetric.
1
Magnitude
Magnitude of H()
0.8
0.6
0.4
0.2
-4 -3 -2 -1 0 1 2 3 4
Frequency , rad/sample
1
Nonlinear Phase
0.5
Phase of H()
-0.5
-1
-4 -3 -2 -1 0 1 2 3 4
Frequency , rad/sample
(C) The sequence h(n) = {0.25, 0.5, –0.25} is not symmetric.
0.9
Magnitude
Magnitude of H()
0.8
0.7
0.6
0.5
-4 -3 -2 -1 0 1 2 3 4
Frequency , rad/sample
4
Nonlinear Phase
2
Phase of H()
-2
-4
-4 -3 -2 -1 0 1 2 3 4
Frequency , rad/sample
Magnitude of H()
0.6
0.4
0.2
0
-4 -3 -2 -1 0 1 2 3 4
Frequency , rad/sample
2
Phase = - + /2
1
Phase of H()
-1
-2
-4 -3 -2 -1 0 1 2 3 4
Frequency , rad/sample
Frequency response
Realization of linear phase FIR filters An important special subset of FIR filters has a linear
phase characteristic. Linear phase results if the impulse response is symmetric about its center.
For a causal filter whose impulse response begins at 0 and ends at N–1, this symmetry is
expressed thus
This symmetry allows the transfer function to be rewritten so that only half the number of
multiplications is required for the resulting realization.
Linear phase – phase and delay distortion Assume a low pass filter with frequency response
H (e j ) given by
H (e j ) = 1 e j k , |ω| < ωc
0, ωc < |ω| < π
where k is an integer. This is a linear phase filter with the slope of the phase “curve” in the pass
band being –k. Let X (e j ) represent the Fourier transform of an input sequence x(n). Then the
transform of the output sequence y(n) is given byY (e j )= X (e j ) . H (e j ) . If X (e j ) is entirely
within the pass band of H (e j ) then
Y (e j )= X (e j ) . e j k
So the output signal y(n) can be obtained as the inverse F-transform of Y (e j ) as
|H|
ω
–ωc ωc
H
–kω
Thus the linear phase filter did not alter the shape of the original signal, simply translated
(delayed) it by k samples. If the phase response had not been linear, the output signal would have
been a distorted version of x(n).
It can be shown that a causal IIR filter cannot produce a linear phase characteristic and
that only special forms of causal FIR filters can give linear phase.
Theorem If h(n) represents the impulse response of a discrete time system, a necessary and
sufficient condition for linear phase is that h(n) have a finite duration N, and that it be symmetric
about its midpoint.
Example 4.3.1 (a) For the FIR filter of length N = 7 with impulse response h(n) let h(n) = h(N–
1–n). Show that the filter has a linear phase characteristic. (b) Repeat for N = 8.
h(n)
1 5 n
0 2 3 4 6
N–1
Solution (a) For N = 7, the positive symmetry relation h(n) = h(N–1–n) leads to h(n) = h(6–n)
which means that h(0) = h(6), h(1) = h(5), and h(2) = h(4), as shown in figure above.
6 6
H(z) = h(n)z n
and H (e j ) = H (z) z e j
= h(n)e j n
n0 n0
j j j 2 j3
H (e ) = h(0) + h(1) e + h(2) e + h(3)e
j 4 j5
+ h(4) e + h(5)e + h(6) e j 6
= e j3 { h(0)e j3 + h(1)e j 2 + h(2)e j + h(3)
+ h(4)e j + h(5) e j 2 + h(6)e j3 }
Since h(0) = h(6), etc., we can write
=e j3
a(k) cos k , with a(0) = h(3) and a(k) = 2h(3–k), k = 1, 2, 3
k 0
linear, with slope = –3 = – (N– 1)/2 which means that the delay is an integer number of samples.
H(ω) or Θ(ω)
Slope = –3
(b) For N = 8, the positive symmetry relation h(n) = h(N–1–n) leads to h(n) = h(7–n), which
means h(0) = h(7), h(1) = h(6), h(2) = h(5), and h(3) = h(4) as shown in figure below.
h(n)
1 6 n
0 2 3 4 5 7
N–1
7 7
is clearly linear. However, the slope of the phase curve is (–7/2), which is not an integer. The
non-integer delay will cause the values of the sequence to be changed, which, in some cases,
may be undesirable.
H(ω) or Θ(ω)
Slope = –7/2
Implementation For a causal filter whose impulse response has even symmetry:
h(n) z z ( N 1n)
H(z) = n
n0
Figure for N = 8
h(1) = h(6)
+ y(n)
h(2) = h(5)
+
+
h(3) = h(4)
+
For odd N We need not derive the equations (they would be necessary if we were writing a
computer program to automate it). For N = 7, there are N – 1 = 6 delay elements – an even number
of delay elements. There are (N + 1)/2 = (7 + 1)/2 = 4 multiplications and 4 adders (the number of
two-operand additions is 6).
Figure for N = 7
x(n–1) x(n–2) x(n–3) x(n–4) x(n–5) x(n–6)
x(n) –1 –1 –1 –1 –1 –1
z z z z z z
h(0) = h(6)
+
h(1) = h(5)
+
y(n)
h(2) = h(4) +
+
h(3)
Properties of FIR digital filters The sinusoidal steady state transfer function of a digital filter is
periodic in the sampling frequency. We have
h(n)e
j j n
H (e ) = H (z) z e j =
n
in which h(n) represents the terms of the unit pulse response. The above expression can be
decomposed into real and imaginary components by writing
H (e j
)= h(n) cos n – j h(n) sin n = HR(ω) + j HI(ω)
n n
where the real and imaginary parts of the transfer function are given by
H (e j
)= h(n) cos n = HR(ω)
n
3. Similarly, if h(n) is an odd sequence, the real part of the transfer function,
HR(ω), will be zero
H (e j
)=–j h(n) sin n = j HI(ω)
n
Thus an even unit pulse response yields a real-valued transfer function and an odd unit
pulse response yields on imaginary-valued transfer function. Recall that a real transfer function
has a phase shift of 0 or radians, while an imaginary transfer function has a phase shift of
/ 2 radians as shown in figures below. So, by making the unit pulse response either even or
odd, we can generate a transfer function that is either real or imaginary.
n n
Θ(ω) Θ(ω)
π/2
Θ(ω) = 0
–π π –π π
–π/2
Two types of applications In designing digital filters we are usually interested in one of the
following two situations:
1. Filtering We are interested in the amplitude response of the filter (e.g., low
pass, band pass, etc.) without phase distortion. This is realized by using a real
valued transfer function, i.e., H (e j ) = HR(ω), with HI(ω) = 0.
2. Filtering plus quadrature phase shift These applications include integrators,
differentiators, and Hilbert transform devices. For all of these the desired
transfer function is imaginary, i.e., H (e j ) = j HI(ω), with HR(ω) = 0
Phase delay and group delay If we consider a signal that consists of several frequency
components (such as a speech waveform or a modulated signal) the phase delay of the filter is
the amount of time delay each frequency component of the signal suffers in going through the
filter. Mathematically, the phase delay τp is given by secant
()
τp =
The group delay on the other hand is the average time delay the composite signal suffers at each
frequency. The group delay τg is given by the slope (tangent) at ω
d()
τg =
d
j
where Θ(ω) = H (e ) of the filter.
A nonlinear phase characteristic will cause phase distortion, which is undesirable in many
applications, for example, music, data transmission, video and biomedicine.
A filter is said to have a linear phase response if its phase response satisfies one of the
following relationships:
Θ(ω) = – kω → (A) or Θ(ω) = β – kω → (B)
where k and β are constants. If a filter satisfies equation (A) its group delay and phase delay are
the same constant k. It can be shown that for condition (A) to be satisfied the impulse response of
the filter must have positive symmetry (aka even symmetry or just symmetry). The phase
response in this case is simply a function of the filter length N:
k = (N–1)/2
If equation (B) is satisfied the filter will have a constant group delay only. In this case, the
impulse response h(n) has negative symmetry (aka odd symmetry or antisymmetry):
h(n) = – h(N–1–n)
k = (N–1)/2
β = /2
Analog filter background of phase and group delay Phase delay “at a given frequency” is the
slope of the secant line from dc to the particular frequency and is a sort of overall average delay
parameter. Phase delay is computed over the frequency range representing the major portion of
the input signal spectrum (0 to F1 in the figure below).
Tangent at F1
H (F) Slope = group delay at F1
Phase curve
Secant at F1
Slope = phase delay over 0 to F1
F
F1
The group delay at a given frequency represents the slope of the tangent line at the
particular frequency and represents a local or narrow range (neighborhood of F1 in the figure)
delay parameter.
A case of significance involving both phase delay and group delay is that of a narrow
band modulated signal. When a narrow band modulated signal is passed through a filter, the
carrier is delayed by a time equal to the phase delay, while the envelope (or intelligence) is
delayed by a time approximately equal to the group delay. Since the intelligence (modulating
signal) represents the desired information contained in such signals, strong emphasis on good
group delay characteristics is often made in filters designed for processing modulated
waveforms.
Summary of symmetry
Positive symmetry (or just “symmetry” or even symmetry about the middle) is characterized
by h(n) = h(N–1–n). Show that for positive symmetry
( N 1) / 2
a) For N odd (Type I): j
H (e ) = e j ( N 1) / 2
a(k) cos k
k 0
N 1 N 1
a(0) = h & a(k) = 2h k,k≠0
2 2
N /2
N
b(k) = 2h k
2
h(n) Type I
h(n) Type II
N is odd
N is even
Center of Symmetry Center of Symmetry
n
n
0 6 7
0
N–1 N–1
Summary of symmetry, cont’d
Negative symmetry (or “antisymmetry” or odd symmetry about the middle) is characterized
by h(n) = – h(N–1–n). Show that for negative symmetry
N 1
j ( N 1) / 2
j
a(k)sin k
2 2
a) For N odd (Type III): H (e )= e
k 0
N 1 N 1
a(0) = h & a(k) = 2h k,k≠0
2 2
N 1
j N/ 2
N
b(k) = 2h k
2
Type III Type IV
h(n) h(n)
N is odd N is even
Center of Symmetry Center of Symmetry
6 7
N–1 N–1
n n
0 0
Qualitative nature of symmetry
Type I Positive symmetry, N is odd. To illustrate take N = 5:
( N 1) / 2 2
j
H (e ) = e j ( N 1) / 2
a(k) cos k = e
k 0
j 2
a(k) cos k
k 0
j 2
= e [a(0) + a(1) cos ω + a(2) cos 2ω]
We have to add up a(0), and the two cosine terms. It is clear that at ω = 0 all the cosine terms are
at their positive peak, so that when added the response of H (e j ) vs. ω would indicate a low
pass filter. Consider
x(n) x(n 1) x(n 2) x(n 3) x(n 4)
y(n) = 5
H (e j ) = H (z) 1 e
j
e j 2 e j3 e j 4
=
z e j
5
e j 2 e j 1 e j e j 2 1 2cos 2cos 2
= e j 2 = e j 2
5 5
%Frequency response of moving average filter h(n) = {0.2, 0.2, 0.2, 0.2, 0.2}
b5 = [0.2, 0.2, 0.2, 0.2, 0.2], a = [1]
w=-pi: pi/256: pi; Hw5=freqz(b5, a, w);
subplot(2, 1, 1), plot(w, abs(Hw5)); legend ('Magnitude'); title ('Type I, N is odd');
xlabel('Frequency \omega, rad/sample'), ylabel('Magnitude of H(\omega)'); grid
subplot(2, 1, 2), plot(w, angle(Hw5)); legend ('Phase');
xlabel('Frequency \omega, rad/sample'), ylabel('Phase of H(\omega)'); grid
Type I, N is odd
1
Magnitude
Magnitude of H()
0.5
0
-4 -3 -2 -1 0 1 2 3 4
Frequency , rad/sample
4
Phase
2
Phase of H()
-2
-4
-4 -3 -2 -1 0 1 2 3 4
Frequency , rad/sample
Type II Positive symmetry, N is even. Take N = 6:
N /2 3
H (e j ) = e j ( N 1) / 2 b(k) cos[(k 1/ 2)] = e j5 / 2 b(k) cos[(k 1/ 2)]
k 1 k 1
j5 / 2
=e [b(1) cos ω/2 + b(2) cos 3ω/2 + b(3) cos 5ω/2]
At =, corresponding to half the sampling frequency (maximum possible frequency), all the
cosine terms will be zero. Thus this type of filter is unsuitable as a high-pass filter. It should be
ok as a low pass filter. Consider
x(n) x(n 1) x(n 2) x(n 3) x(n 4) x(n 5)
y(n) =
6
j 2
H (e j ) = H (z) 1 e e
j
e j3 e j 4 e j5
=
z e j
6
j (5/ 2) e
j (5 / 2)
e j (3/ 2)
e j (1/ 2)
e j (1/ 2) e j (3/ 2) e j (5 / 2)
=e
6
cos( / 2) cos(3 / 2) cos(5 / 2) e j (5/ 2)
=
3
%Frequency response of moving average filter h(n) = {1/6, 1/6, 1/6, 1/6, 1/6, 1/6}
b6 = [1/6, 1/6, 1/6, 1/6, 1/6, 1/6], a = [1]
w=-pi: pi/256: pi; Hw6=freqz(b6, a, w);
subplot(2, 1, 1), plot(w, abs(Hw6)); legend ('Magnitude');
title ('Type II, N is even');
xlabel('Frequency \omega, rad/sample'), ylabel('Magnitude of H(\omega)'); grid
subplot(2, 1, 2), plot(w, angle(Hw6)); legend ('Phase');
xlabel('Frequency \omega, rad/sample'), ylabel('Phase of H(\omega)'); grid
0.5
0
-4 -3 -2 -1 0 1 2 3 4
Frequency , rad/sample
4
Phase
2
Phase of H()
-2
-4
-4 -3 -2 -1 0 1 2 3 4
Frequency , rad/sample
Type III Negative symmetry, N is odd. This introduces a 900 (= π/2) phase shift. Because of the
sine terms |H| is always zero at ω = 0 and at ω = π/2 (half the sampling frequency). Therefore the
filter is unsuitable as a low pass or a high pass filter. To illustrate take N = 5 and
= e j 2 j ( / 2) k
0
a(k) sin k
N 1
a(0) = h = h(2) = 0
2
N 1
a(k) = 2 h k = 2h2 k , k ≠ 0
2
Etc.
%Frequency response of Type III filter, h(n) = {0.2, 0.2, 0, -0.2, -0.2}
b5 = [0.2, 0.2, 0, -0.2, -0.2], a = [1]
w=-pi: pi/256: pi; Hw5=freqz(b5, a, w);
subplot(2, 1, 1), plot(w, abs(Hw5)); legend ('Magnitude');
title ('Type III, N is odd');
xlabel('Frequency \omega, rad/sample'), ylabel('Magnitude of H(\omega)'); grid
subplot(2, 1, 2), plot(w, angle(Hw5)); legend ('Phase');
xlabel('Frequency \omega, rad/sample'), ylabel('Phase of H(\omega)'); grid
0.6
0.4
0.2
0
-4 -3 -2 -1 0 1 2 3 4
Frequency , rad/sample
4
Phase
2
Phase of H()
-2
-4
-4 -3 -2 -1 0 1 2 3 4
Frequency , rad/sample
Type IV Negative symmetry, N is even. This introduces a 900 (= π/2) phase shift. Because of the
sine terms |H| is always zero at ω = 0. Therefore the filter is unsuitable as a low pass filter. To
illustrate take N = 6 and
k 1
=e
2 2
b(k) sin[(k 1/ 2)]
k1
3
Etc.
%Frequency response of Type IV filter h(n) = {1/6, 1/6, 1/6, -1/6, -1/6, -1/6}
b6 = [1/6, 1/6, 1/6, -1/6, -1/6, -1/6], a = [1]
w=-pi: pi/256: pi; Hw6=freqz(b6, a, w);
subplot(2, 1, 1), plot(w, abs(Hw6)); legend ('Magnitude');
title ('Type IV, N is even');
xlabel('Frequency \omega, rad/sample'), ylabel('Magnitude of H(\omega)'); grid
subplot(2, 1, 2), plot(w, angle(Hw6)); legend ('Phase');
xlabel('Frequency \omega, rad/sample'), ylabel('Phase of H(\omega)'); grid
0.6
0.4
0.2
0
-4 -3 -2 -1 0 1 2 3 4
Frequency , rad/sample
4
Phase
2
Phase of H()
-2
-4
-4 -3 -2 -1 0 1 2 3 4
Frequency , rad/sample
Types III and IV are often used to design differentiators and Hilbert transformers because of
the 900 phase shift that each one can provide.
The phase delay for Type I and II filters or group delay for all four types of filters is
expressible in terms of the number of coefficients of the filter and so can be corrected to give a
zero phase or group delay response.
N 1
Types I and II: τp = τg = –Θ(ω)/ω = T
2
d() N 1
Types III and IV: τg = = T
d 2
Magnitude (|H(ω)|) response at
ω = 0 rad. ω = π rad.
Type I Max Low pass
Type II Zero OK as LP
Not OK as HP filter
Type III Zero Zero 900 Phase shift
Type IV Zero 900 Phase shift
Design of FIR digital filters – The Fourier series and windowing method
This method of filter design originates with the observation that the sinusoidal steady state
transfer function of a digital filter is periodic in the sampling frequency. Since H() is a
continuous and periodic function of we can expand it into a Fourier series. The resulting
Fourier coefficients are the impulse response, h(n). The major disadvantage is that one cannot
easily specify in advance the exact values for pass band and stop band attenuation/ripple levels,
so it may be necessary to check several alternate designs to get the required one.
Consider the ideal low pass filter with frequency response Hd (e j) or Hd () as shown
below. The subscript d means that it is the desired or ideal filter.
|Hd(ω)| Hd(ω) = 0
ω
–2π –π –ωc 0 ωc π 2π
Hd (e ) e d = 1e d
j n
hd(n) =
2 2 c
sin nc
= , – ∞ n ∞, n ≠ 0
n
c n=0
,
This is a non-causal infinite impulse response sequence. It is made a finite impulse response
sequence by truncating it symmetrically about n = 0; it is made causal by shifting the truncated
sequence to the right so that it starts at n = 0. The shifting results in a time delay and we shall
ignore it for now. The truncation results in the sequence ht(n) where the subscript t means
truncation but we shall ignore the subscript
In general h(n) can be thought of as obtained by multiplying hd(n) with a window function w(n)
as follows
h(n) = hd(n) . w(n)
For the h(n) obtained by simple truncation as above the window function is a rectangular
window given by
Let H (e j ) , Hd (e j ) and W (e j) represent the Fourier transforms of h(n), hd(n) and w(n)
respectively. Then the frequency response H (e j ) of the resulting filter is the convolution of
H d (e j ) and W (e j) given by
1
Hd (e j )W (e j ( ) d = dH (e j )*W (e j )
j
H (e ) =
2
The convolution produces a smeared version of the ideal low pass filter. In other words,
H (e j ) is a smeared version of H (e j ) . In general, the wider the main lobe ofW (e j) , the
d
more spreading or smearing, whereas the narrower the main lobe (larger N), the closer
H (e j ) comes to Hd (e j ) .
For any arbitrary window the transition band of the filter is determined by the width of
the main lobe of the window. The side lobes of the window produce ripples in both pass band
and stop band.
In general, we are left with a trade-off of making N large enough so that smearing is minimized,
yet the number of filter coefficients (= N) is not too large for a reasonable implementation. Some
commonly used windows are the rectangular, Bartlett (triangular), Hanning, Hamming,
Blackman, and Kaiser windows.
j
hd(n) H d (e )
n ω
w(n) W (e j )
n ω
h(n) = hd(n).w(n) H (e j )
Example 4.4.1 [Design of 9-coefficient LP FIR filter] Design a nine-coefficient (or 9-point or
9-tap) FIR digital filter to approximate an ideal low-pass filter with a cut-off frequency c= 0.2.
The magnitude response, Hd () , is given below. Take Hd () = 0.
|Hd(ω)|
2
2 0.2
j n
0.2 j 0.2 n j 0.2 n
e
= sin 0.2 n
1 e (e )
= 2 jn =
0.2 2 jn n
Since hd(n) ≠ 0 for n < 0 this is a noncausal filter (also, it is not BIBO stable – see Unit IV). The
rest of the design is aimed at coming up with a noncausal approximation of the above impulse
response.
For a rectangular window of length 9, the corresponding impulse response is obtained by
evaluating hd(n) for –4 n 4 on a calculator. In the MATLAB segment below, which
generates the hd(n) coefficients for –50 n 50, division by zero for n = 0 causes “NaN” (Not
a Number), while all the other coefficients are correct. In generating the frequency
response H () we copy and paste all the coefficients except for hd(0) which is entered by hand.
d (sin 0.2 n)
dn 0.2 cos 0.2 n
hd(0) = = = 0.2
d ( n) n0
dn n0
Aside (MATLAB) The segment below generates and stem-plots the hd(n) coefficients.
n = -50 to 50
Warning: Divide by zero.
hdn = -0, -0.0038, -0.0063, -0.0064, -0.0041, 0, 0.0043 0.0070 0.0072,
0.0046 -0, -0.0048 -0.0080 -0.0082 -0.0052 0, 0.0055 0.0092, 0.0095
0.0060 -0, -0.0065 -0.0108 -0.0112 -0.0072 0, 0.0078, 0.0132 0.0138
0.0089 -0, -0.0098 -0.0168 -0.0178 -0.0117 0, 0.0134 0.0233 0.0252
0.0170 -0, -0.0208 -0.0378 -0.0432 -0.0312, 0, 0.0468 0.1009 0.1514
0.1871 NaN 0.1871 0.1514 0.1009, 0.0468 0.0000 -0.0312 -0.0432
-0.0378 -0.0208 -0.0000 0.0170 0.0252, 0.0233 0.0134 0.0000 -0.0117
-0.0178 -0.0168 -0.0098 -0.0000 0.0089, 0.0138 0.0132 0.0078 0.0000
-0.0072 -0.0112 -0.0108 -0.0065 -0.0000, 0.0060 0.0095 0.0092 0.0055
0.0000 -0.0052 -0.0082 -0.0080 -0.0048, -0.0000 0.0046 0.0072 0.0070
0.0043 0.0000 -0.0041 -0.0064 -0.0063, -0.0038 -0.0000
hd(n) = (sin (0.2*pi*n)) / (pi*n)
0.2
0.15
0.1
hd(n)
0.05
-0.05
-50 -40 -30 -20 -10 0 10 20 30 40 50
n
Note 1 The segment below is used to get a quick look at the hd(n) coefficients and their
symmetry. The MATLAB problem with n = 0 may be avoided by replacing n with (n – 0.001).
This will affect the other coefficients very slightly (which is not a serious problem as far as
demonstrating the even symmetry of hd(n)) but the accuracy of the coefficients is somewhat
compromised in the third or fourth significant digit.
hdn = 0.0467, 0.1009, 0.1513, 0.1871, 0.2, 0.1871, 0.1514, 0.1010, 0.0468
hd(n) = (sin (0.2*pi*n)) / (pi*n)
0.2
0.18
0.16
0.14
0.12
hd(n)
0.1
0.08
0.06
0.04
0.02
0
-4 -3 -2 -1 0 1 2 3 4
n
Note 2 As an alternative to the above, one could write a custom program to calculate all
coefficients exactly including hd(0).
End of Aside
The values are shown in table below:
n= –4 –3 –2 –1 0 1 2 3 4
ht(n) = {0.047, 0.101, 0.151, 0.187, 0.2, 0.187, 0.151, 0.101, 0.047}
By a rectangular window of length 9 we mean that we retain the above 9 values of hd(.)
and truncate the rest outside the window. Thus
0.2
0.047
–6 6
n
–5 0 5
The transfer function of this filter is
Ht(z) = 4
hd (n)z n
= 0.047 z 4 + 0.101 z3 + 0.151 z 2 + 0.187 z1 + 0.2 z0
n 4
The causal filter is then given by delaying the sequence ht(n) by 4 samples. That is, h(n) = ht(n–
4), and the resulting transfer function is
H(z) = z–4 Ht(z)
= 0.047 (1 z8 ) + 0.101 (z1 z7 ) + 0.151 (z2 z6 )
+ 0.187 (z3 z5 ) + 0.2 z 4
We may obtain the frequency response of this realizable (causal) filter by setting z = e j ,
j
that is, H (e ) = H (z) j . Because of the truncation the magnitude |H| will only be
z e
approximately equal to |Hd| – Gibbs phenomenon, see comparison of 9 coefficients versus 101
coefficients below. Further, because of the delay the phase H = –4ω whereas, as originally
dH ()
specified, Hd = 0. The slope = –4, showing that the filter introduces a delay of 4
d
samples.
H
– 4ω
Magnitude of H() 1
0.5
0
-4 -3 -2 -1 0 1 2 3 4
Frequency , rad/sample
4
9 coefficients
2
Phase of H()
-2
-4
-4 -3 -2 -1 0 1 2 3 4
Frequency , rad/sample
%Comparison of 9 coefficients vs. 101 coefficients
%Filter coefficients
b9=[0.0468, 0.1009, 0.1514, 0.1871, 0.2, 0.1871, 0.1514, 0.1009, 0.0468],
a=[1]
b101 = [-0.0 -0.0038 -0.0063 -0.0064 -0.0041 0.0, 0.0043 0.0070 0.0072
0.0046 -0.0, -0.0048 -0.0080 -0.0082 -0.0052 0.0, 0.0055 0.0092,
0.0095 0.0060 -0.0, -0.0065 -0.0108 -0.0112 -0.0072 0.0, 0.0078
0.0132 0.0138 0.0089 -0.0, -0.0098 -0.0168 -0.0178 -0.0117 0.0,
0.0134 0.0233 0.0252 0.0170 -0.0, -0.0208 -0.0378 -0.0432 -0.0312
0.0, 0.0468 0.1009 0.1514 0.1871 0.2 0.1871 0.1514 0.1009 0.0468
0.0 -0.0312 -0.0432 -0.0378 -0.0208 -0.0 0.0170 0.0252, 0.0233
0.0134 0.0 -0.0117 -0.0178 -0.0168 -0.0098 -0.0 0.0089, 0.0138
0.0132 0.0078 0.0 -0.0072 -0.0112 -0.0108 -0.0065 -0.0, 0.0060
0.0095 0.0092 0.0055 0.0 -0.0052 -0.0082 -0.0080 -0.0048, -0.0
0.0046 0.0072 0.0070 0.0043 0.0 -0.0041 -0.0064 -0.0063, -0.0038 -
0.0]
w=-pi: pi/256: pi;
Hw9=freqz(b9, a, w);
Hw101=freqz(b101, a, w);
plot(w, abs(Hw9), w, abs(Hw101), 'k')
legend ('9 coefficients', '101 coefficients');
title('Magnitude Response');
xlabel('Frequency \omega, rad/sample'), ylabel('Magnitude of H(\omega)'); grid
Magnitude Response
1.4
9 coefficients
101 coefficients
1.2
1
Magnitude of H()
0.8
0.6
0.4
0.2
0
-4 -3 -2 -1 0 1 2 3 4
Frequency , rad/sample
Rectangular window In this example the sequence hd(n), which extends to infinity on both
sides, has been truncated to 9 terms. This truncation process can be thought of as multiplying the
infinitely long sequence by a window function called the rectangular window, wR(n). The figure
below shows both hd(n) and wR(n) in the undelayed form, that is, symmetrically disposed about n
= 0.
Specifying the window function The interval over which the window function is defined
hd(n)
–6 6
n
–5 0 5
wR(n)
n
–6 –5 0 5 6
depends on whether we first delay hd(n) and then truncate it or the other way around. If, instead
of truncating first and then delaying, we adopt the procedure of first delaying hd(n) and then
truncating it, the window function may be defined over the interval 0 n N–1, where N is the
number of terms retained. With this understanding the rectangular window, wR(n), is given
below.
wR(n) = 1, 0 n N–1
0, elsewhere
n= 0 1 2 3 4 5 6 7 8
wHam(n) = {0.08, 0.215, 0.54, 0.865, 1, 0.865, 0.54, 0.215, 0.08}
wHam(n) 1
0.08
n
0 1 2 3 4 5 6 7 8
Imagine that we line up this sequence alongside the hd(n) given earlier. (This means we should
imagine wHam(n) is moved to the left by 4 samples). We then multiply the two sequences at each
point to get the windowed sequence, ht(n):
n= –4 –3 –2 –1 0 1 2 3 4
hd(n) = {0.047, 0.101, 0.151, 0.187, 0.2, 0.187, 0.151, 0.101, 0.047}
w(n) = {0.08, 0.215, 0.54, 0.865, 1, 0.865, 0.54, 0.215, 0.08}
ht(n) = {0.00382, 0.0216, 0.0815, 0.1617, 0.2, 0.1617, 0.0815, 0.0216, 0.00382}
We compare below the 9-tap Hamming windowed filter to the filter without the window.
Magnitude Response
1.4
9 coefficients, No window
9 coefficients, Hamming window
1.2
1
Magnitude of H()
0.8
0.6
0.4
0.2
0
-4 -3 -2 -1 0 1 2 3 4
Frequency , rad/sample
Example 4.4.2 [Low pass filter] [2003] Design a low pass FIR filter that approximates the
following frequency response
H(F) = 1, 0 F 1000 Hz
0, elsewhere in 0 F Fs/2
where the sampling frequency Fs is 8000 sps. The impulse response duration is to be limited to
2.5 msec. Draw the filter structure.
Solution Note the specs are given in Hertz. On the digital frequency scale goes from 0 to 2,
with 2 corresponding to the sampling frequency of Fs = 8000 Hz or to s = 2 8000 rad/sec.
Based on this 1000 Hz corresponds to (1/8)2 = /4. Or we may use the relation = T to
convert the analog frequency 1000 Hz to the digital frequency. Thus
|H(F)| or |Hd(ω)|
Take Hd(ω) = 0
1
F
–1k 0 1k 4k 8k
ω
0 π/4 π 2π
n
0 20
N–1
n = -50 to 50
Warning: Divide by zero.
hdn = [0.0064 0.0046 -0.0000 -0.0048 -0.0069 -0.0050 0.0000 0.0052
0.0076 0.0055 -0.0000 -0.0058 -0.0084 -0.0061 0.0000 0.0064
0.0094 0.0068 -0.0000 -0.0073 -0.0106 -0.0078 0.0000 0.0083
0.0122 0.0090 -0.0000 -0.0098 -0.0145 -0.0107 0.0000 0.0118
0.0177 0.0132 -0.0000 -0.0150 -0.0227 -0.0173 0.0000 0.0205
0.0318 0.0250 -0.0000 -0.0322 -0.0531 -0.0450 0.0000 0.0750
0.1592 0.2251 NaN 0.2251 0.1592 0.0750 0.0000 -0.0450 -
0.0531 -0.0322 -0.0000 0.0250 0.0318 0.0205 0.0000 -0.0173 -
0.0227 -0.0150 -0.0000 0.0132 0.0177 0.0118 0.0000 -0.0107
-0.0145 -0.0098 -0.0000 0.0090 0.0122 0.0083 0.0000 -0.0078 -
0.0106 -0.0073 -0.0000 0.0068 0.0094 0.0064 0.0000 -0.0061 -
0.0084 -0.0058 -0.0000 0.0055 0.0076 0.0052 0.0000 -0.0050 -
0.0069 -0.0048 -0.0000 0.0046 0.0064]
n= 0 ±1 ±2 ±3 ±4 ±5 ±6 ±7 ±8 ±9 ±10
ht(n) = 0.25 0.2251 0.1592 0.075 0 -0.045 0.0531 -0.0322 0 0.025 0.0318
10
realizable FIR filter as H(z) = z –10 Ht(z) from which the filter structure can be drawn. The
frequency response is compared below for 21 and 101 coefficients. The 21-tap filter is not that
bad.
1
Magnitude of H()
0.8
0.6
0.4
0.2
0
-4 -3 -2 -1 0 1 2 3 4
Frequency , rad/sample
Example 4.4.3 [Very narrow band pass filter] [2003] Design a band pass FIR filter that
approximates the following frequency response:
when the sampling frequency is 8000 sps. Limit the duration of impulse response to 2 msec.
Draw the filter structure.
Solution The sampling frequency Fs = 8000 Hz corresponds to ω = 2 rad. Thus
|Hd(ω)|
Take Hd(ω) = 0
ω
–π –0.05π –0.04π 0 0.04π 0.05π π
H d (e j) = 1, – 0.05 ω – 0.04 and 0.04 ω 0.05
0, elsewhere in the range [– to ]
1 j j n
1 0.04 j n 0.05
d
j n
hd(n) =
2
H (e ) e d =
2 0.05
1e d 1e
0.04
d
j n 0.04
= 1 e + e j n
jn 0.05
2 jn 0.04
1 e j 0.04 n e j 0.05 n e j 0.05 n e j 0.04 n
=
j2 n
1 e e ej 0.04 n e j 0.04 n
= j 0.05 n j 0.05 n
n j2 j2
sin 0.05 n sin 0.04 n
=
n
h(n)
n
0 16
N–1
Ht(z) = h (n)z
n 8
t
n
n = -50 to 50
Warning: Divide by zero.
hdn =[0.0064 0.0072 0.0080 0.0085 0.0089 0.0092 0.0092 0.0091
0.0087 0.0082 0.0076 0.0067 0.0058 0.0047 0.0035 0.0022 0.0009
-0.0005 -0.0018 -0.0031 -0.0044 -0.0056 -0.0066 -0.0076 -0.0084 -
0.0090 -0.0095 -0.0097 -0.0098 -0.0097 -0.0094 -0.0088 -0.0082 -
0.0073 -0.0063 -0.0052 -0.0039 -0.0026 -0.0012 0.0002 0.0016
0.0029 0.0042 0.0055 0.0066 0.0076 0.0084 0.0091 0.0096 0.0099
NaN 0.0099 0.0096 0.0091 0.0084 0.0076 0.0066 0.0055 0.0042
0.0029 0.0016 0.0002 -0.0012 -0.0026 -0.0039 -0.0052 -0.0063 -
0.0073 -0.0082 -0.0088 -0.0094 -0.0097 -0.0098 -0.0097 -0.0095 -
0.0090 -0.0084 -0.0076 -0.0066 -0.0056 -0.0044 -0.0031 -0.0018 -
0.0005 0.0009 0.0022 0.0035 0.0047 0.0058 0.0067 0.0076 0.0082
0.0087 0.0091 0.0092 0.0092 0.0089 0.0085 0.0080 0.0072
0.0064]
n= 0 ±1 ±2 ±3 ±4 ±5 ±6 ±7 ±8
hd(n) = 0.01 0.0099 0.0096 0.0091 0.0084 0.0076 0.0066 0.0055 0.0042
The frequency responses 17-tap and 101-tap filters are shown below. The 17-tap filter
looks more like a low pass filter! Owing to the very narrow pass band a very large number of
coefficients is needed before the pass band becomes discernible. In general FIR filters are
characterized by a large number of coefficients compared to IIR filters.
%Filter coefficients
b17=[0.0042 0.0055 0.0066 0.0076 0.0084 0.0091 0.0096 0.0099
0.01 0.0099 0.0096 0.0091 0.0084 0.0076 0.0066 0.0055 0.0042],
a=[1]
b101=[0.0064 0.0072 0.0080 0.0085 0.0089 0.0092 0.0092 0.0091
0.0087 0.0082 0.0076 0.0067 0.0058 0.0047 0.0035 0.0022 0.0009
-0.0005 -0.0018 -0.0031 -0.0044 -0.0056 -0.0066 -0.0076 -0.0084 -
0.0090 -0.0095 -0.0097 -0.0098 -0.0097 -0.0094 -0.0088 -0.0082 -
0.0073 -0.0063 -0.0052 -0.0039 -0.0026 -0.0012 0.0002 0.0016
0.0029 0.0042 0.0055 0.0066 0.0076 0.0084 0.0091 0.0096 0.0099
0.01 0.0099 0.0096 0.0091 0.0084 0.0076 0.0066 0.0055 0.0042
0.0029 0.0016 0.0002 -0.0012 -0.0026 -0.0039 -0.0052 -0.0063 -
0.0073 -0.0082 -0.0088 -0.0094 -0.0097 -0.0098 -0.0097 -0.0095 -
0.0090 -0.0084 -0.0076 -0.0066 -0.0056 -0.0044 -0.0031 -0.0018 -
0.0005 0.0009 0.0022 0.0035 0.0047 0.0058 0.0067 0.0076 0.0082
0.0087 0.0091 0.0092 0.0092 0.0089 0.0085 0.0080 0.0072
0.0064]
w=-pi: pi/256: pi; Hw17=freqz(b17, a, w); Hw101=freqz(b101, a, w);
subplot(2, 1, 1), plot(w, abs(Hw17)); legend ('17 coefficients');
xlabel('Frequency \omega, rad/sample'), ylabel('Magnitude of H(\omega)'); grid
subplot(2, 1, 2), plot(w, abs(Hw101)); legend ('101 coefficients');
xlabel('Frequency \omega, rad/sample'), ylabel('Magnitude of H(\omega)'); grid
0.2
17 coefficients
Magnitude of H()
0.15
0.1
0.05
0
-4 -3 -2 -1 0 1 2 3 4
Frequency , rad/sample
0.8
101 coefficients
Magnitude of H()
0.6
0.4
0.2
0
-4 -3 -2 -1 0 1 2 3 4
Frequency , rad/sample
Example 4.4.4 [Band pass filter] [2003] Design a band pass filter to pass frequencies in the
range 1 to 2 rad/sec using Hanning window with N = 5. Draw the filter structure and plot its
spectrum.
Solution The Hanning window is also known as the Hann window. It is a raised cosine, is very
similar to the Hamming window, and is given by
Note In order to convert the analog frequencies to digital we need the sampling time T. The
sampling frequency Fs (or the sampling time T) is not specified. We assume T = 1 sec or, what
amounts to the same, we assume that the frequencies given are actually digital, that is, 1 to 2
rad/sample instead of 1 to 2 rad/sec. However, the solution below assumes that the frequencies
are given correctly, that is, that they are analog, and uses a sampling frequency of s = 4 rad /
sec.
Although there is a specialized version of the sampling theorem for band pass signals we
shall simply take the sampling frequency to be twice the highest frequency which is 2 rad / sec.
Thus we shall take s = 4 rad / sec. This then gives us a high pass filter rather a band pass.
However, if we take, say, s = 8 rad / sec., we shall have a band pass filter. We shall next
convert the analog frequency specs to digital ( ):
|Hd(ω)|
Take Hd(ω) = 0
ω
–π –π/2 0 π/2 π
2 2 /2
= 1 e + e j n = 1 e j n / 2 e j n e j n e j n / 2
j n / 2
jn jn / 2 j2 n
1 e e ej n / 2 e j n / 2 = sin( n) sin( n / 2)
2
= j n j n
n j2 j2 n
hd(0) = 0.5 by L’Hopital’s rule
Ht(z) = h (n)z
n 2
t
n
Delay by 2 samples to get h(n) = ht(n–2) and H(z) = z–2 Ht(z). Now draw the direct form structure
j
for H(z). The spectrum is given by H (e ) = H (z) z ej . We compare below filters lengths of 5
and 101 without the Hanning window.
1
Magnitude of H()
0.8
0.4
0.2
0
-4 -3 -2 -1 0 1 2 3 4
Frequency , rad/sample
We compare below the frequency responses of the 5-tap filter with and without the
Hanning window. It can be seen that the Hanning window aggravates what is already a poor
(short) filter length. There may be more to gain by increasing the filter length than by
windowing.
n = -2 to 2
wn = 1.0000 0.5000 0 0.5000 1.0000
Magnitude Response
1.4
5 coefficients, No window
5 coefficients, Hanning window
1.2
1
Magnitude of H()
0.8
0.6
0.4
0.2
0
-4 -3 -2 -1 0 1 2 3 4
Frequency , rad/sample
Example 4.4.5 [High pass filter] [2008] Design a high pass linear phase filter with frequency
response
H d (e j ) = 1 e j3 , c
0, elsewhere in the range [– to]
The number of filter coefficients is N = 7 and c = /4. Use (a) rectangular window and (b)
Hamming window.
|Hd(ω)|
ω
–π –π/4 0 π/4 π
Hd(ω)
–3ω
ω
–π π
() e j nd = 1 / 4 j 3 j n
H 1 j 3 j n
hd(n) = 1
d 1 e e d e e d
2 2 /4
/ 4
1 j (n3) d e j (n3) d
= 2 e
/ 4 / 4
j (n3)
1 e j (n3) e
= +
2 j(n 3) j(n 3) / 4
=
1 e j (n3) / 4 e j (n3) e j (n3) e j (n3) / 4
j2 (n 3)
1 e e ej (n3)/ 4 e j (n3)/ 4
= j (n3) j (n3)
(n 3) j2 j2
sin (n 3) sin (n 3) / 4
=
(n 3)
This sequence is centered at n = 3. Since the filter length is N = 7 we can calculate the 7
coefficients as {hd(n), 0 ≤ n ≤ 6}. In other words we truncate it outside the interval 0 ≤ n ≤ 6;
moreover, there is no need to right-shift the truncated sequence.
In general, one may not know the filter length with certainty and there is no special
advantage in specifying the phase, Hd(ω), as anything but zero. We calculate 101 coefficients
sin( n) sin( n / 4)
of the sequence centered about n = 0, that is, hd(n) = :
n
hd(0) = 0.75 by L’Hopital’s rule
n = –50 to 50
Warning: Divide by zero.
hdn = [-0.0064 -0.0046 -0.0000 0.0048 0.0069 0.0050 -0.0000 -0.0052
-0.0076 -0.0055 -0.0000 0.0058 0.0084 0.0061 -0.0000 -0.0064 -
0.0094 -0.0068 -0.0000 0.0073 0.0106 0.0078 -0.0000 -0.0083 -
0.0122 -0.0090 -0.0000 0.0098 0.0145 0.0107 -0.0000 -0.0118 -
0.0177 -0.0132 -0.0000 0.0150 0.0227 0.0173 -0.0000 -0.0205 -
0.0318 -0.0250 -0.0000 0.0322 0.0531 0.0450 -0.0000 -0.0750 -
0.1592 -0.2251 NaN -0.2251 -0.1592 -0.0750 -0.0000 0.0450
0.0531 0.0322 -0.0000 -0.0250 -0.0318 -0.0205 -0.0000 0.0173
0.0227 0.0150 -0.0000 -0.0132 -0.0177 -0.0118 -0.0000 0.0107
0.0145 0.0098 -0.0000 -0.0090 -0.0122 -0.0083 -0.0000 0.0078
0.0106 0.0073 -0.0000 -0.0068 -0.0094 -0.0064 -0.0000 0.0061
0.0084 0.0058 -0.0000 -0.0055 -0.0076 -0.0052 -0.0000 0.0050
0.0069 0.0048 -0.0000 -0.0046 -0.0064]
The 7-tap and 101-tap filter responses are shown below
Magnitude Response
1.4
7 coefficients
101 coefficients
1.2
1
Magnitude of H()
0.8
0.6
0.4
0.2
0
-4 -3 -2 -1 0 1 2 3 4
Frequency , rad/sample
Example 4.4.6 [Band-stop filter] Design a band-stop linear phase filter with the following
frequency response. The number of filter coefficients is N = 31.
|Hd(ω)|
hd(n) = 1
H () e j nd = 1 3 / 1e
4 j n
d 1e d 1e j n
/4 j n
2
d
2
/ 4 3 / 4
j n 3 / 4 j n /4 j n
1 e + e + e
=
2 jn jn / 4 jn 3 / 4
=…
|Hd(ω)|
ω
–π 0 π
–0.02π 0.02π
The MATLAB calculation of coefficients follows (good for all n except 0 where we fill in the
value 0.02):
n = -50 to 50
Warning: Divide by zero.
hdn = -0.0000 0.0004 0.0008 0.0013 0.0017 0.0022 0.0027 0.0032
0.0037 0.0042 0.0047 0.0052 0.0057 0.0063 0.0068 0.0074 0.0079
0.0085 0.0090 0.0095 0.0101 0.0106 0.0112 0.0117 0.0122 0.0127
0.0132 0.0137 0.0142 0.0147 0.0151 0.0156 0.0160 0.0164 0.0168
0.0172 0.0175 0.0178 0.0182 0.0184 0.0187 0.0190 0.0192 0.0194
0.0195 0.0197 0.0198 0.0199 0.0199 0.0200 NaN 0.0200 0.0199
0.0199 0.0198 0.0197 0.0195 0.0194 0.0192 0.0190 0.0187 0.0184
0.0182 0.0178 0.0175 0.0172 0.0168 0.0164 0.0160 0.0156 0.0151
0.0147 0.0142 0.0137 0.0132 0.0127 0.0122 0.0117 0.0112 0.0106
0.0101 0.0095 0.0090 0.0085 0.0079 0.0074 0.0068 0.0063 0.0057
0.0052 0.0047 0.0042 0.0037 0.0032 0.0027 0.0022 0.0017 0.0013
0.0008 0.0004 -0.0000
15
10
hd(n)
-5
-50 -40 -30 -20 -10 0 10 20 30 40 50
n
MATLAB plots of magnitude and phase response of the 9-coefficient narrower band LP filter
follow:
Magnitude of H()
0.15
0.1
0.05
0
-4 -3 -2 -1 0 1 2 3 4
Frequency , rad/sample
4
9 coefficients
2
Phase of H()
-2
-4
-4 -3 -2 -1 0 1 2 3 4
Frequency , rad/sample
The MATLAB plots below enable us to compare (only visually) the magnitude responses
of the two 9-coefficient filters, the only difference being that Ex 1 has a band width of 0.2π while
Ex 2 is very narrow at 0.02π.
From the plots it clear that the narrow-band filter of Example 6 is no where near either the band
width or the gain specified. In contrast, the wider band width filter of Example 1 is relatively
much closer to specification.
1.4
Ex1, 9 coefficients
Ex6, 9 coefficients
1.2
1
Magnitude of H()
0.8
0.6
0.4
0.2
0
-4 -3 -2 -1 0 1 2 3 4
Frequency , rad/sample
In the MATLAB plots below we have increased the number of coefficients to 51 for both
filters, the only difference being that Ex 1 has a band width of 0.2π while Ex 2 is very narrow at
0.02π.
% Magnitude responses compared: Ex 1 and Ex 7 (51-coefficient LP filters)
%Filter coefficients
b51ex1=[0.0, 0.0078 0.0132 0.0138 0.0089 -0.0, -0.0098 -0.0168 -
0.0178 -0.0117 0.0, 0.0134 0.0233 0.0252 0.0170 -0.0, -0.0208 -
0.0378 -0.0432 -0.0312 0.0, 0.0468 0.1009 0.1514 0.1871 0.2
0.1871 0.1514 0.1009 0.0468 0.0 -0.0312 -0.0432 -0.0378 -0.0208 -
0.0 0.0170 0.0252, 0.0233 0.0134 0.0 -0.0117 -0.0178 -0.0168 -
0.0098 -0.0 0.0089, 0.0138 0.0132 0.0078 0.0],
%
b51ex7= [0.0127 0.0132 0.0137 0.0142 0.0147 0.0151 0.0156
0.0160 0.0164 0.0168 0.0172 0.0175 0.0178 0.0182 0.0184 0.0187
0.0190 0.0192 0.0194 0.0195 0.0197 0.0198 0.0199 0.0199 0.0200
0.02 0.0200 0.0199 0.0199 0.0198 0.0197 0.0195 0.0194 0.0192
0.0190 0.0187 0.0184 0.0182 0.0178 0.0175 0.0172 0.0168 0.0164
0.0160 0.0156 0.0151 0.0147 0.0142 0.0137 0.0132 0.0127],
a=[1]
w=-pi: pi/256: pi;
Hw51ex1=freqz(b51ex1, a, w); Hw51ex7=freqz(b51ex7, a, w);
plot(w, abs(Hw51ex1), w, abs(Hw51ex7), 'k')
legend ('Ex1, 51 coefficients', 'Ex7, 51 coefficients');
xlabel('Frequency \omega, rad/sample'), ylabel('Magnitude of H(\omega)'); grid
From the plots it clear that the narrow-band filter of Example 6 still has a long way to go. In
contrast, the wider band width filter of Example 1 is almost there.
1.4
Ex1, 51 coefficients
Ex6, 51 coefficients
1.2
1
Magnitude of H()
0.8
0.6
0.4
0.2
0
-4 -3 -2 -1 0 1 2 3 4
Frequency , rad/sample
We turn now to filtering plus quadrature phase shift. These applications include
integrators, differentiators, and Hilbert transform devices. For all of these the desired transfer
function is imaginary, i.e., H (e j ) = j HI(ω), with HR(ω) = 0
Example 4.4.8 [The ideal differentiator] In the analog situation the ideal differentiator is given
by the transfer function H(s) = s with the frequency response H(Ω) = jΩ, for 0 Ω . The
digital version of the ideal differentiator may be defined as
|Hd(ω)|
π
ω
–π π
–π
Hd(ω)
π/2
ω
–π π
–π/2
Since Hd () is periodic in ω with period 2, we can expand in into a Fourier series as
h
j n
Hd () = d (n) e
n
where the Fourier coefficients hd(n) (the impulse response) are given by
1
H d () e d
j n
hd(n) =
2
Substituting Hd () = jω, we get
j j n
1 j e j nd = e j n 1. e d
hd(n) =
2 2 jn jn
=
j
e ( )e e
j n j n
j n
2 ( jn)2
jn
= e e – j e e
j n j n j n j n
2 2
2n 2 j n
cos n
cos n sin n – 0, n = non-zero integers
= – =
n n 2
n
sin n
where we have used the fact that = 0 for non-zero integer values of n. For n = 0 the value
n2
of hd(0) is evaluated from the defining equation, viz.,
1 j
j e d = 2 j d = 2 2 = 0
j 0 1 2
hd(0) =
2
Thus
cos n
hd(n)= , n = non-zero integers
n
0, n=0
%Ideal Differentiator
% Generate hdn = (cos(n*pi)) /(n) and stem plot
n = -50: 50, hdn = (cos(n*pi)) ./(n), stem(n, hdn)
xlabel('n'), ylabel('hd(n)'); grid; title ('hd(n) = (cos(n*pi)) /(n)')
n = –50 to 50
Warning: Divide by zero.
hdn =[-0.0200 0.0204 -0.0208 0.0213 -0.0217 0.0222 -0.0227 0.0233
-0.0238 0.0244 -0.0250 0.0256 -0.0263 0.0270 -0.0278 0.0286 -
0.0294 0.0303 -0.0313 0.0323 -0.0333 0.0345 -0.0357 0.0370 -
0.0385 0.0400 -0.0417 0.0435 -0.0455 0.0476 -0.0500 0.0526 -
0.0556 0.0588 -0.0625 0.0667 -0.0714 0.0769 -0.0833 0.0909 -
0.1000 0.1111 -0.1250 0.1429 -0.1667 0.2000 -0.2500 0.3333 -
0.5000 1.0000 0 -1.0000 0.5000 -0.3333 0.2500 -0.2000 0.1667 -
0.1429 0.1250 -0.1111 0.1000 -0.0909 0.0833 -0.0769 0.0714 -
0.0667 0.0625 -0.0588 0.0556 -0.0526 0.0500 -0.0476 0.0455 -
0.0435 0.0417 -0.0400 0.0385 -0.0370 0.0357 -0.0345 0.0333
-0.0323 0.0313 -0.0303 0.0294 -0.0286 0.0278 -0.0270 0.0263 -
0.0256 0.0250 -0.0244 0.0238 -0.0233 0.0227 -0.0222 0.0217 -
0.0213 0.0208 -0.0204 0.0200]
We can see the odd symmetry of hd(n) from the following stem plot (note that the correct
value of hd(0) = 0; the MATLAB segment used here has hd(0) = ∞ which is not correct).
hd(n) = (cos(n*pi)) /(n)
1
0.8
0.6
0.4
0.2
hd(n)
-0.2
-0.4
-0.6
-0.8
-1
-50 -40 -30 -20 -10 0 10 20 30 40 50
n
%Ideal Differentiator
%9-tap filter coefficients
b9=[ -0.2500 0.3333 -0.5000 1.0000 0 -1.0000 0.5000 -0.3333
0.2500],
a=[1]
%101-tap filter coefficients
b101=[-0.0200 0.0204 -0.0208 0.0213 -0.0217 0.0222 -0.0227 0.0233
-0.0238 0.0244 -0.0250 0.0256 -0.0263 0.0270 -0.0278 0.0286 -
0.0294 0.0303 -0.0313 0.0323 -0.0333 0.0345 -0.0357 0.0370 -
0.0385 0.0400 -0.0417 0.0435 -0.0455 0.0476 -0.0500 0.0526 -
0.0556 0.0588 -0.0625 0.0667 -0.0714 0.0769 -0.0833 0.0909 -
0.1000 0.1111 -0.1250 0.1429 -0.1667 0.2000 -0.2500 0.3333 -
0.5000 1.0000 0 -1.0000 0.5000 -0.3333 0.2500 -0.2000 0.1667 -
0.1429 0.1250 -0.1111 0.1000 -0.0909 0.0833 -0.0769 0.0714 -
0.0667 0.0625 -0.0588 0.0556 -0.0526 0.0500 -0.0476 0.0455 -
0.0435 0.0417 -0.0400 0.0385 -0.0370 0.0357 -0.0345 0.0333 -
0.0323 0.0313 -0.0303 0.0294 -0.0286 0.0278 -0.0270 0.0263 -
0.0256 0.0250 -0.0244 0.0238 -0.0233 0.0227 -0.0222 0.0217 -
0.0213 0.0208 -0.0204 0.0200],
w=-pi: pi/256: pi;
Hw9=freqz(b9, a, w);
Hw101=freqz(b101, a, w);
plot(w, abs(Hw9), w, abs(Hw101), 'k')
legend ('9 coefficients', '101 coefficients');
title('Magnitude Response');
xlabel('Frequency \omega, rad/sample'), ylabel('Magnitude of H(\omega)'); grid
Magnitude Response
4
9 coefficients
3.5 101 coefficients
3
Magnitude of H()
2.5
1.5
0.5
0
-4 -3 -2 -1 0 1 2 3 4
Frequency , rad/sample
Example 4.4.9 [The Hilbert transformer] This is used to generate signals that are in phase
quadrature to an input sinusoidal signal (or, more generally, an input narrowband waveform).
That is, if the input to a Hilbert transformer is the signal xa(t) = cos Ω0t, the output is ya(t) = sin
Ω0t. The Hilbert transformer is used in communication systems in various modulation schemes.
The frequency response of the Hilbert transformer is (Figure)
H d (e j) = – j sgn(), –
where the sgn(ω) is the signum function defined as |Hd()|
sgn(ω) = 1 if ω is positive 1
–1 if ω is negative
–π π
H d ( )
π/2
–π π
Since j = e j / 2 we may also express H d(e j ) also as
–π/2
H d (e j ) = – e j / 2 = –j = 1 at –/2, 0
e j / 2 = j = 1 at /2, – 0
Note that the magnitude H d (e j) = 1 for all ω and Hd() changes from /2 to –/2 at ω = 0.
The filter coefficients are the Fourier coefficients given by
1
1 j e d ( j) e d
H d () e d = 2
j n 0 j n j n
hd(n) =
2 0
j n j n
( j) e
0
j e
= 2 jn +
2 jn
0
=
1
(1 e ) (e 1) = 1 2 e j n e j n
j n j n
2 n 2 n
2 2cos n 1 cos n
= = , n≠0
2 n n
For n = 0, hd(0) may be evaluated from the defining equation:
1 1
j 0 0
hd(0) = H d ( ) e d =
2
j1d ( j)1d
2 0
j
j – =0
0
=
2 2 0
Thus
hd(n) = 2/n, n odd
0, n even (including 0)
%Hilbert Transform
%Generate hdn = 2/(n*pi) for odd n & hdn = 0 for even n, and stem plot
n = -50: 50, hdn = 2 ./(n*pi), stem(n, hdn)
%Hilbert Transform
%Stem plot hdn = 2/(n*pi) for odd n & hdn = 0 for even n
n = -50: 50,
hdn =[0 -0.0130 0 -0.0135 0 -0.0141 0 -0.0148 0 -0.0155 0 -0.0163
0 -0.0172 0 -0.0182 0 -0.0193 0 -0.0205 0 -0.0220 0 -0.0236 0 -
0.0255 0 -0.0277 0 -0.0303 0 -0.0335 0 -0.0374 0 -0.0424 0 -
0.0490 0 -0.0579 0 -0.0707 0 -0.0909 0 -0.1273 0 -0.2122 0 -
0.6366 0 0.6366 0 0.2122 0 0.1273 0 0.0909 0 0.0707 0
0.0579 0 0.0490 0 0.0424 0 0.0374 0 0.0335 0 0.0303 0
0.0277 0 0.0255 0 0.0236 0 0.0220 0 0.0205 0 0.0193 0
0.0182 0 0.0172 0 0.0163 0 0.0155 0 0.0148 0 0.0141 0
0.0135 0 0.0130 0],
stem(n, hdn)
xlabel('n'), ylabel('hd(n)'); grid;
title ('hd(n) = 2/(n*pi) for odd n & hdn = 0 for even n')
0.6
0.4
0.2
hd(n)
-0.2
-0.4
-0.6
-0.8
-50 -40 -30 -20 -10 0 10 20 30 40 50
n
Frequency response
%Hilbert Transform
%Comparison of 9 coefficients vs. 101 coefficients
%9-tap filter coefficients
b9=[0 -0.2122 0 -0.6366 0 0.6366 0 0.2122 0],
a=[1]
b101 =[ 0 -0.0130 0 -0.0135 0 -0.0141 0 -0.0148 0 -0.0155 0 -
0.0163 0 -0.0172 0 -0.0182 0 -0.0193 0 -0.0205 0 -0.0220 0 -
0.0236 0 -0.0255 0 -0.0277 0 -0.0303 0 -0.0335 0 -0.0374 0 -
0.0424 0 -0.0490 0 -0.0579 0 -0.0707 0 -0.0909 0 -0.1273 0 -
0.2122 0 -0.6366 0 0.6366 0 0.2122 0 0.1273 0 0.0909 0
0.0707 0 0.0579 0 0.0490 0 0.0424 0 0.0374 0 0.0335 0
0.0303 0 0.0277 0 0.0255 0 0.0236 0 0.0220 0 0.0205 0
0.0193 0 0.0182 0 0.0172 0 0.0163 0 0.0155 0 0.0148 0
0.0141 0 0.0135 0 0.0130 0]
w=-pi: pi/256: pi;
Hw9=freqz(b9, a, w);
Hw101=freqz(b101, a, w);
plot(w, abs(Hw9), w, abs(Hw101), 'k')
legend ('9 coefficients', '101 coefficients');
title('Magnitude Response');
xlabel('Frequency \omega, rad/sample'), ylabel('Magnitude of H(\omega)'); grid
Magnitude Response
1.4
9 coefficients
101 coefficients
1.2
1
Magnitude of H()
0.8
0.6
0.4
0.2
0
-4 -3 -2 -1 0 1 2 3 4
Frequency , rad/sample
Window functions [Ref. S.K. Mitra] We want to see the frequency behavior of window
functions by themselves. Note that depending on convenience we shall define the window
functions either over – (N–1)/2 n (N–1)/2 or over 0 ≤ n ≤ (N–1). In the former case the
phase function will be zero; in the latter case, used especially in MATLAB, the phase has a
negative slope.
There are fixed windows and adjustable windows. Among the fixed windows we have (in
addition to the rectangular window) the following tapered windows:
1. Bartlett (triangular) window
2. Hann (aka Hanning or von Hann) window
3. Hamming window
4. Blackman window
These windows result in a fixed amount of ripple in the frequency response of the designed filter.
The Kaiser window is an adjustable window which allows some control over the ripple.
2n
Bartlett: w(n) = 1 , – (N–1)/2 n (N–1)/2
N 1
2 n
Hann: w(n) = 0.5 + 0.5 cos , – (N–1)/2 n (N–1)/2
N 1
2 n
Hamming: w(n) = 0.54 + 0.46 cos , – (N–1)/2 n (N–1)/2
N 1
2 n 4 n
Blackman: w(n) = 0.42 + 0.5 cos + 0.08 cos , – (N–1)/2 n (N–1)/2
N 1 N 1
The following MATLAB multiplot gives a graphical comparison of the above window
functions. Note that all are discrete sequences; to make it easy on the eyes some are plotted as
continuous lines and some as discrete.
Window functions
1
Rectangular
0.9 Bartlett
Hanning
0.8
Hamming
Blackman
0.7
0.6
w(n)
0.5
0.4
0.2
0.1
0
-15 -10 -5 0 5 10 15
n
%Window functions defined over n = –(N–1)/2 to (N–1)/2
N = 31; n = -(N-1)/2: (N-1)/2;
wHn = 0.5 + 0.5 * cos(2*pi*n/(N-1)); %Hanning
wHm = 0.54 + 0.46 * cos(2*pi*n/(N-1)); %Hamming
wBl = 0.42 + 0.5 * cos(2*pi*n/(N-1)) + 0.08 * cos(4*pi*n/(N-1)); %Blackman
%
subplot(3, 1, 1), stem(n, wHn); legend ('Hanning');
xlabel('n'), ylabel('w(n)'); grid
subplot(3, 1, 2), stem(n, wHm); legend ('Hamming');
xlabel('n'), ylabel('w(n)'); grid
subplot(3, 1, 3), stem(n, wBl); legend ('Blackman');
xlabel('n'), ylabel('w(n)'); grid
1
Hanning
w(n)
0.5
0
-15 -10 -5 0 5 10 15
n
1
Hamming
w(n)
0.5
0
-15 -10 -5 0 5 10 15
n
1
Blackman
w(n)
0.5
0
-15 -10 -5 0 5 10 15
n
The rectangular window defined over – (N–1)/2 n (N–1)/2 is given by
n
N 1 0 N 1
2 2
0.9
0.8
0.7
0.6
w(n)
0.5
0.3
0.2
0.1
0
-5 -4 -3 -2 -1 0 1 2 3 4 5
n
W e j = w(n)e j n
n
= n ( 1e j n
N 1) / 2
N 1 N 3 N 1
j j j
j j
= e + e
2 + … + e + 1 + e + … +e
2 2
We can simplify the above in one of two ways. One possibility is
W e j = e 2 1 e j e j 2 ... e j N 1 = e 2 1 e
N 1 N 1 j N
j j
j
1e
N terms
e jN / 2
e jN / 2 e jN / 2 e j N / 2 =
j e j N / 2
N 1
2
= e j / 2 j / 2
e j / 2
e
j / 2
e e e j / 2
sin (N / 2)
=
sin ( / 2)
Using L’Hopital’s rule,
(N / 2) cos (N / 2)
W (e j ) 0 =
(1/ 2) cos ( / 2) 0
=N
n
= n ( 1e j n
N 1) / 2
N 1 N 3 N 1
j j j
j j
= e+ e
+ … + e + 1 + e + … +e
2
2 2
N 1
= 1 + 2 cos ω + 2 cos 2ω + … + 2 cos
2
N 1
This consists of 1 terms and should be normalized by dividing by N.
2
1 sin (N / 2)
Using the equation W e j = , its zero-crossings occur when (N 2) equals
N sin ( / 2)
integer multiples of π, that is,
(N 2) = ± kπ or ω = k(2π/N), k≠ 0
The spectrum between the zero-crossings at – (2π/N) and (2π/N) is called the main lobe, the
remaining lobes are called side lobes. The width of the main lobe is
As the length of the window, N, is increased the lobes become narrower; also the height of the
main lobe increases (= N). However, with reference to the normalized frequency response
W e j = sin (N / 2)
1
N sin ( / 2)
the height of the main lobe, W (e j ) 0, stays at 1 (or 0 dB) while the side lobes keep getting
smaller with increasing N.
In the MATLAB segment below the window is defined over 0 ≤ n ≤ (N–1) rather than
over – (N–1)/2 ≤ n ≤ (N–1)/2.
Note in the plot below that the height of the main lobe is 11 (= N). The width of the main lobe is
taken as the separation between the zero crossings on either side of ω = 0:
Width of main lobe = 4π/N = 4π/11
From the plot, by eyeballing, we can gather:
1. For a given window length the side lobes have the same width.
2. For a given window length the magnitude of the side lobes decreases with
increasing frequency
15
Magnitude (Length = 11)
Magnitude of H()
10
0
-4 -3 -2 -1 0 1 2 3 4
Frequency , rad/sample
4
Phase
2
Phase of H()
-2
-4
-4 -3 -2 -1 0 1 2 3 4
Frequency , rad/sample
Normalized frequency r In the MATLAB segment below the window is defined over 0 ≤ n ≤
(N–1). Further we define the normalized frequency r = ω/π. As ω varies from –π to π the
normalized frequency varies from –1 to 1.
Note in the plot below that as ω goes from –π to π the normalized frequency r goes from –1 to 1.
15
Length = 11
Magnitude of H()
10
0
-4 -3 -2 -1 0 1 2 3 4
Frequency , rad/sample
15
Length = 11
Magnitude of H(r)
10
0
-1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1
Normalized Frequency r
Normalized magnitude In the MATLAB segment below we go another step: we normalize the
magnitude by dividing it by N. The window is defined over 0 ≤ n ≤ (N–1) and the normalized
frequency is r = ω/π. As ω varies from –π to π the normalized frequency varies from –1 to 1.
Note in the plot below that the height of the main lobe is 1 since it is normalized.
Normalized magnitude
1
Length = 11
Magnitude of H()
0
-4 -3 -2 -1 0 1 2 3 4
Frequency , rad/sample
Normalized magnitude
1
Length = 11
Magnitude of H(r)
0.5
0
-1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1
Normalized Frequency r
Comparison of two rectangular windows of lengths 11 and 31 In the MATLAB segment
below we go another step: we normalize the magnitude by dividing it by N. The window is
defined over 0 ≤ n ≤ (N–1) and the normalized frequency is r = ω/π. As ω varies from –π to π the
normalized frequency varies from –1 to 1.
Only the first side lobe is of concern since all the other side lobes are smaller. From the plot
below the maximum of the first side lobe is a little over 20% of the height of the main lobe in
both windows.
1
Length = 11
Magnitude of H(r)
0.5
0
-1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1
Normalized Frequency r
1
Length = 31
Magnitude of H(r)
0.8
0.4
0.2
0
-1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1
Normalized Frequency r
Two rectangular windows of lengths 11 and 31 compared on a multi-plot In the MATLAB
segment below we compare the two window lengths on the same multi-plot. As before, the
window is defined over 0 ≤ n ≤ (N–1) and the normalized frequency is r = ω/π. As ω varies from
–π to π the normalized frequency varies from –1 to 1.
From the plot, by eyeballing, we can gather that for a given window length the magnitude
of the side lobes decreases with increasing frequency. Further, as the window length
increases the height of a specific side lobe (such as the first side lobe) decreases: for
instance the height of the first side lobe for N = 31 is smaller than that of the first side
lobe for N = 11.
0.8
Magnitude of H(r)
0.6
0.5
0.4
0.3
0.2
0.1
0
-1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1
Normalized Frequency r
The Hamming window defined over – (N–1)/2 n (N–1)/2 is
n = -5 -4 -3 -2 -1 0 1 2 3 4 5
w(n) = {0.0800 0.0901 0.1198 0.1679 0.2322 0.3100 0.3979 0.4919 0.5881
0.6821 0.7700 0.8478 0.9121 0.9602 0.9899 1.0000 0.9899 0.9602 0.9121
0.8478 0.7700 0.6821 0.5881 0.4919 0.3979 0.3100 0.2322 0.1679 0.1198
0.0901 0.0800}
Hamming window
1
0.9
0.7
0.6
w(n)
0.5
0.4
0.3
0.2
0.1
0
-15 -10 -5 0 5 10 15
n
n n ( N 1)/ 2
( N 1) / 2 ( N 1) / 2
= 0.54 e
n ( N 1) / 2
j n
+ 0.46{cos 2 n /( N 1)}e
n ( N 1)/ 2
j n
j 2 n /( N 1) j 2 n /( N 1) j n
( N 1) / 2
%Magnitude at DC
N = 11:10:41,
WdcN = 0.54*N + 0.46* sin(pi*N./(N-1))./sin(pi./(N-1))
N = 11 21 31 41
WdcN = 5.4800 10.8800 16.2800 21.6800
The width of the main lobe is taken as the separation between the zero crossings on either
side of ω = 0. This is obtained by setting W e j = 0 and solving for ω; it is given as
For N = 11, the Hamming window is given by wHam(n) = 0.54 – 0.46 cos( n / 5) , 0 n 10.
In the phase plot below the phase reaches –π in the interval 0 ≤ ω ≤ 1 and is therefore adjusted by
adding 2π; this is not due to a zero-crossing. The same applies to the phase adjustment in the
interval –1 ≤ ω ≤ 0.
Hamming window, Frequency response
6
Magnitude (Length = 11)
Magnitude of H()
0
-4 -3 -2 -1 0 1 2 3 4
Frequency , rad/sample
4
Phase
2
Phase of H()
-2
-4
-4 -3 -2 -1 0 1 2 3 4
Frequency , rad/sample
%Magnitude response of Hamming window defined over n = 0 to N–1
%Length 11
N = 11; n = 0: N-1; b11 = 0.54 - 0.46 *cos((2*pi/(N-1) .*n)); a=[1];
w=-pi: pi/768: pi; r = w/pi; % normalized frequency
Hr11n= freqz(b11, a, pi*r); % Frequency response
% Plot
plot(r, abs(Hr11n)); legend ('Length = 11');
title('Hamming window, Frequency response');
xlabel('Normalized Frequency r'), ylabel('Magnitude of H(r)'); grid
4
Magnitude of H(r)
0
-1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1
Normalized Frequency r
%Magnitude response of Hamming window defined over n = 0 to N–1
%Length 11
N = 11; n = 0: N-1; b11 = 0.54 - 0.46 *cos((2*pi/(N-1) .*n)); a=[1];
w=-pi: pi/768: pi; r = w/pi; % normalized frequency
%Magnitude at dc
WdcN = 0.54*N + 0.46* sin(pi*N/(N-1))/sin(pi/(N-1)),
Hr11n= freqz(b11, a, pi*r)/WdcN; % normalized frequency response
% Plot
plot(r, abs(Hr11n)); legend ('Length = 11');
title('Hamming window, Normalized frequency response');
xlabel('Normalized Frequency r'), ylabel('Magnitude of H(r)'); grid
0.8
0.7
Magnitude of H(r)
0.6
0.5
0.4
0.3
0.2
0.1
0
-1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1
Normalized Frequency r
%Magnitude response of Hamming window defined over n = 0 to N–1
%Length 31
N = 31; n = 0: N-1; b31 = 0.54 - 0.46 *cos((2*pi/(N-1) .*n)); a=[1];
w=-pi: pi/768: pi; r = w/pi; % normalized frequency
Hr31n= freqz(b31, a, pi*r); % Frequency response
% Plot
plot(r, abs(Hr31n)); legend ('Length = 31');
title('Hamming window, Frequency response');
xlabel('Normalized Frequency r'), ylabel('Magnitude of H(r)'); grid
14
12
Magnitude of H(r)
10
0
-1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1
Normalized Frequency r
%Magnitude response of Hamming window defined over n = 0 to N–1
%Length 31
N = 31; n = 0: N-1; b31 = 0.54 - 0.46 *cos((2*pi/(N-1) .*n)); a=[1];
w=-pi: pi/2048: pi; r = w/pi; % normalized frequency
%Magnitude at dc
WdcN = 0.54*N + 0.46* sin(pi*N/(N-1))/sin(pi/(N-1)),
Hr31n= freqz(b31, a, pi*r)/WdcN; % normalized frequency response
% Plot
plot(r, abs(Hr31n)); legend ('Length = 31');
title('Hamming window, Normalized frequency response');
xlabel('Normalized Frequency r'), ylabel('Magnitude of H(r)'); grid
Observations:
1. In the plot below the magnitude of the side lobes appears to stay about the same
with increasing frequency for the first few lobes, but beyond r = 0.6 there is a
discernible (to the eye) fall-off in the height of the side lobes. Relative to the
rectangular window, however, we may say the side lobe height stays about the
same with increasing frequency.
2. The width of the side lobe appears to stay constant with increasing frequency.
0.8
0.7
Magnitude of H(r)
0.6
0.5
0.4
0.3
0.2
0.1
0
-1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1
Normalized Frequency r
Hanning window
Hanning window
1
0.9
0.8
0.7
0.6
w(n)
0.5
0.4
0.3
0.2
0.1
0
-15 -10 -5 0 5 10 15
n
Blackman window
Blackman window
1
0.9
0.8
0.7
0.6
w(n)
0.5
0.4
0.3
0.2
0.1
0
-15 -10 -5 0 5 10 15
n
The width of the main lobe is taken as the separation between the zero crossings on either
side of ω = 0. This is obtained by setting W e j = 0 and solving for ω; it is given as
Bartlett window
1
0.9
0.8
0.7
0.6
w(n)
0.5
0.4
0.3
0.2
0.1
0
-15 -10 -5 0 5 10 15
n
4.5 Choosing between FIR and IIR filters
The choice between FIR and IIR filters depends largely on the relative advantages of the two
types of filters.
(1) Linear phase FIR filters can have exactly linear phase response. This means no phase
distortion. This is an important requirement in, for example, data transmission, biomedicine,
digital audio, and image processing.
The phase response of IIR filters is nonlinear, especially at the band edges.
(2) Stability FIR filters realized non-recursively are always stable. The stability of IIR filters
cannot always be guaranteed.
(3) The effects of finite word length such as round off noise and coefficient quantization errors
are much less severe in FIR than in IIR.
(4) FIR requires more coefficients for sharp cut-off filters than IIR. Thus for a given amplitude
response specification, more processing time and storage will be required for FIR
implementation. However, one can readily take advantage of the computational speed of the FFT
and multirate techniques to improve significantly the efficiency of FIR implementation.
(5) Analog filters can be readily transformed into equivalent IIR digital filters meeting similar
specifications. This is not possible with FIR filters as they have no analog counterpart. However,
with FIR it is easier to synthesize filters of arbitrary frequency response.
(6) In general, FIR is algebraically more difficult to synthesize, if CAD support is not available.
Digital Signal Processing – 5
5 Multirate DSP
Contents:
Time and frequency scaling in continuous-time systems
Transformation of the independent variable
Down-sampling
Up-sampling
Cascading sampling rate converters
Identities
FIR implementation of sampling rate conversion
Polyphase structures
Polyphase structure for a decimator
Discrete-time systems with different sampling rates at various parts of the system are called
multirate systems. They are linear and time-varying systems. Integer sampling rate converters
change the sampling frequency by an integer factor and rational sampling rate converters by a
rational number. Here is a sampling of sampling rates in commercial applications (Mitra):
Sampling Rates
Digital Audio Video
Broadcasting – 32 kHz Composite Video Signal
CD – 44.1 kHz NTSC – 14.3181818 MHz
DAT – 48 kHz PAL – 17.734475 MHz
Digital Component Video Signal
Luminance – 13.5 MHz
Color difference – 6.75 MHz
Time and frequency scaling in continuous-time systems
Illustration An audio signal recorded on cassette tape at a certain speed could be played back at
a higher speed than that at which it was recorded. This is called time scaling, in particular,
compression in the time domain, and results in an inverse effect in the frequency domain, i.e., an
expansion of the frequency spectrum. Similarly when the audio signal is played back at a slower
speed than the recording speed we have expansion in the time domain resulting in a
corresponding compression of the spectrum in the frequency domain.
Given the signal x(t) and its Fourier transform X(Ω), represented notationally by
x(t) X(Ω)
x(t) X(Ω)
t Ω
0 1 –C 0 C
x(2t) X(Ω/2)
t Ω
0 1/2 1 –2C 0 C 2C
x(t/2) X(2Ω)
t Ω
0 1 2 –C/2 0 C/2 C
If x(t) is an audio signal recorded on tape then x(2t) could be the signal x(t) played back at twice
the speed at which x(t) was recorded. The signal x(2t) varies more rapidly than x(t) and the
playback frequencies are higher.
If a < 1 the scaling corresponds to expansion in time. If, for instance, a = 1/2, then x(t/2)
is the signal x(t) played back at half the speed at which x(t) was recorded. The signal x(t/2) varies
slower than x(t) and the playback frequencies are lower. Again, we may visualize this as a new
signal y2(t) = x(t/2); the value of x(.) that occurred at t/2 occurs at t in the case of y2(.) – which is
expansion in time.
Time expansion and frequency compression is found in data transmission from space
probes to receiving stations on earth. To reduce the amount of noise superposed on the signal, it
is necessary to keep the bandwidth of the receiver as small as possible. One means of doing this
is to reduce the bandwidth of the signal: store the data collected by the probe, and then transmit it
at a slower rate. Since the time-scaling factor is known, the signal can be reproduced at the
receiver.
The corresponding operations in the case of discrete-time systems are not quite so
straight forward owing to
1. The need to band limit the continuous-time signal prior to sampling, and
2. The need to avoid aliasing in the process of sampling
Example 5.1 Consider the 4 Hz signal x(t) = cos 2π4t which is obviously band-limited to Fmax =
4 Hz. It is sufficient to sample it at 8 Hz. Alternatively, the signal can be sampled at, say, 16 Hz
or 20 Hz etc. Suppose that it has been over-sampled by a factor of, say, 6 at Fs = 48 Hz to give
x(n) = cos 2π4n(1/48) = cos (πn/6).
(a) If it is desired subsequently to generate from x(n) another signal x1(n) that is a
discrete-time version of x(t) sampled at Fs1 = 16 Hz ( sampling rate reduced by a
factor of 3), then can we do this by simply dropping two samples of x(n) for every
sample that we keep? That is x1(n) = x(3n). This is called down-sampling.
(b) How do we generate from x(n) another signal x2(n) that is a discrete-time version of
x(t) sampled at, say, Fs2 = 96 Hz ( sampling rate doubled)? This is called up-
sampling.
(c) Can we generate from x(n) another signal x3(n) that is a discrete-time version of x(t)
sampled at Fs3 = 6 Hz?
We pick up on this problem again after covering transformation of the independent variable.
Example 5.2.1 Given that x(t) = e5tu(t) is sampled at 50 Hz, find an expression for x(n). Plot
x(t), x(n) and x(2n). Sketch the spectrum of x(n).
Solution The sampling time is T = 0.02 sec. Replacing t with nT we get x(nT) = e5nTu(nT ) , or
x(n) = e 0.1 u(n) = (0.905)n u(n) .
n
We show below three plots: (1) The continuous-time signal x(t), (2) The sampled (at 50 Hz)
version x(n), and (3) x(2n), the 2-fold down-sampled version of x(n); this is equivalent to
sampling x(t) at 25 Hz.
x(t) – Continuous-time
1
x(t) = exp(-5t)
x(t)
0.5
0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
time, sec.
x(nT) at T = 0.02 sec
1
x(n) at 50 Hz
x(n)
0.5
0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
time, sec.
x(nT) at T = 0.04 sec.
1
2-fold down-sampled
x(2n)
0.5
0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
time, sec.
Note that X(s) = ℒ e5t u(t) = 1 (s 5) . Shown below is the MATLAB plot of the
magnitude spectrum |X(jΩ)| of the continuous-time signal x(t) using the function plot. Omega is a
vector, consequently we use “./” instead of “/” etc. The main point to be made here is that X(jΩ)
extends asymptotically to ∞, so, strictly speaking, x(t) is not band-limited. Consequently, the
spectrum X(ω) of the sampled signal x(n) (shown later below) has some built-in aliasing.
x(t) – Continuous-time
1
x(t) = exp(-5t)
x(t)
0.5
0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
time
Magnitude
0.2
|X(Omega)|
Spectrum of x(t)
0.1
0
-20 -15 -10 -5 0 5 10 15 20
Omega, rad/sec
Phase
Phase of X(Omega)
2
Spectrum of x(t)
0
-2
-20 -15 -10 -5 0 5 10 15 20
Omega, rad/sec
Coming to the discrete-time signal, the spectrum of x(n) = anu(n) = (0.905)n u(n) is its
DTFT
X (e j ) = a n e j n =
1 1
=
n0 1 ae j 1 0.905e j
The MATLAB segment is
t1 = 0 : 0.02: 1; xn = exp (-5*t1); %Sampled at 50 Hz.
subplot(3, 1, 1), stem(t1, xn); legend ('x(n) at 50 Hz');
xlabel ('time, sec.'), ylabel('x(n)'); grid; title ('x(nT) at T = 0.02 sec')
%
b = [1]; %Numerator coefficient
a = [1, -0.905]; %Denominator coefficients
w = -6*pi: pi/256: 6*pi; [Xw] = freqz(b, a, w);
subplot(3, 1, 2), plot(w, abs(Xw)); legend ('Spectrum of x(n)');
xlabel('Frequency \omega, rad/sample'), ylabel('Magnitude of X(\omega)'); grid
subplot(3, 1, 3), plot(w, angle(Xw)); legend ('Spectrum of x(n)');
xlabel('Frequency \omega, rad/sample'), ylabel('Phase of X(\omega)'); grid
0.5
0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
time, sec.
Magnitude of X()
20
Spectrum of x(n)
10
0
-20 -15 -10 -5 0 5 10 15 20
Frequency , rad/sample
2
Phase of X()
Spectrum of x(n)
-2
-20 -15 -10 -5 0 5 10 15 20
Frequency , rad/sample
Example 5.2.2 Given x(n) = en / 2u(n), find (a) x(5n/3), (b) x(2n), (c) x(n/2).
Answer The sequence
x(n) = e n / 2u(n) = e 1/ 2 u(n) = (0.606) n u(n) = a n u(n)
n
1 a = e1/ 2 = 0.606
a
a2
a3
a4
n
0 1 2 3 4 5 6
(a) With y(n) = x(5n/3), we evaluate y(n) for several values of n (we have assumed here that x(n)
is zero if n is not an integer):
= e5n / 6 , n = 0, 3, 6, …
0, otherwise
n = 0 1 2 3 4 5 6 7 8 9 10
y(n) = 1 0 0 a5 0 0 a10 0 0 a15 0
a5
a10
n
0 1 2 3 4 5 6
= e–n, n≥0
0, otherwise
n= 0 1 2 3 4 5
y(n) = 1 a2 a4 a6 a8 a10
The sequence y(.) is made up of every other sample of x(.). This is down-sampling or
decimation by a factor of 2 (or, compression in time). Note that some of the original sample
values have disappeared. The sequence is sketched below.
(c) With y(n) = x(n/2) = e n / 4u(n), we evaluate y(.) for several values of n (again, we have
assumed here that x(n) is zero if n is not an integer):
= e–n/ 4, n = 0, 2, 4, …
0, otherwise
n= 0 1 2 3 4 5 6
y(n) = 1 0 a 0 a2 0 a3
The sequence y(.) is constructed by inserting one zero between successive samples of x(.). This is
up-sampling or interpolation by a factor of 2 (or expansion in time). The sequence is sketched
below:
x(n) = e–n/ 4 n = 0, 2, …
0, otherwise
1
a a = e–1/ 2 = 0.606
a2
a3
n
0 1 2 3 4 5 6
To get back to the problem raised earlier, given the sequence x(n) obtained from x(t) at a
rate (1/T)
we want to obtain the sequence x(n) which corresponds to a sampling rate (1/ T ) where T ≠ T
x(t) x(n T ) x(n) , rate (1/ T )
Example 5.2.3 Consider the 4 Hz signal x(t) = cos 2π4t which is obviously band-limited to Fmax
= 4 Hz. It is sufficient to sample it at 8 Hz. Suppose that it has been over-sampled by, say, a
factor of 6 at Fs = 48 Hz to give x(n) = cos 2π4n(1/48) = cos (πn/6).
If it is desired subsequently to generate from x(n) another signal x1(n) that is a discrete-
time version of x(t) sampled at Fs1 = 16 Hz (sampling rate reduced or down-sampled by a factor
of 3), then can we do this by dropping two samples of x(n) for every sample that we keep? In this
specific example this is possible since a sampling rate of 16 Hz is clearly greater than 2Fmax of 8
Hz. Thus the down-sampled version is obtained by replacing n in x(n) by 3n
Let us compare this with what we would get if we were to sample x(t) = cos 2π4t directly at 16
Hz. We simply replace t by nT = n(1/16)
x(t) 0
-1
0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45 0.5
time, sec.
x(nT) at T = 1/48 = 0.020 sec.
1
x(n) at 48 Hz
x(n)
-1
0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45 0.5
time, sec.
3-fold down-sampled, x(nT) at T = 1/16 = 0.0625 sec.
1
x(3n)
-1
0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45 0.5
time, sec.
The band-limited signal, denoted x1(t) is then sampled at the reduced rate of Fs/K to generate
x1(n). This method is generally undesirable because of all the imperfections inherent in originally
generating x(n) from x(t) at a sampling rate of Fs, converting x(n) back into x(t), then band-
limiting x(t) to Fs/2K to generate x1(t) and then sampling x1(t) at a sampling rate of Fs/K to
generate x1(n).
Sampling rate decimation Reducing the sampling rate by an integer factor in the discrete-time
domain is shown in the following block diagram. The down arrow in K indicates down
sampling by a factor of K. The filter H(z) is a digital anti-aliasing filter whose output v(n) is a
low pass filtered version of x(n).
If the filter H(z) is implemented as a linear phase FIR filter with (M+1) coefficients
specified as {br, r = 0 to M}, (some call it “Mth order”), then
M
v(n) = br x(n r)
r0
Example 5.2.4 Consider the 4 Hz signal x(t) = cos 2π4t which is obviously band-limited to Fmax
= 4 Hz. It is sufficient to sample it at 8 Hz. Suppose instead that it has been over sampled, say,
by a factor of 6 at Fs = 48 Hz to give x(n) = cos 2π4n(1/48) = cos (πn/6).
Can we generate from x(n) another signal x3(n) that is a discrete-time version of x(t)
sampled at Fs3 = Fs/8 = 6 Hz? This is down sampling by a factor of 8. We simply replace t by nT
= n(1/6) to get
In other words, x3(n) is made up of every 8th sample of x(n). For every sample value of x(n) we
keep we discard the next 7 samples. We know, however, that a sampling frequency of 6 Hz does
not satisfy the sampling theorem; in this case down sampling has been taken too far.
We show below three plots: (1) The sampled (at 48 Hz) version x(n) – this is repeated
from above, (2) x(2n), the 2-fold down-sampled version of x(n); this is equivalent to sampling
x(t) at 24 Hz, and (3) x(8n), the 8-fold down-sampled version of x(n); this is equivalent to
sampling x(t) at the unacceptably low rate of 6 Hz.
x(nT) at T = 1/48
1
x(n) at 48 Hz
x(n)
-1
0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45 0.5
time, sec.
2-fold down-sampled, x(nT) at T = 1/24 sec.
1
x(2n)
-1
0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45 0.5
time, sec.
8-fold down-sampled, x(nT) at T = 1/6 sec.
1
x(8n)
-1
0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45 0.5
time, sec.
Example 7.2.5 To show visually a case of down sampling that is not satisfactory, consider x4(n)
generated from x(n) by down sampling by a factor of 12, i.e., x4(n) = x(12n). This is also
obtained by sampling at 48/12 = 4 Hz:
which has no resemblance to x(n), making it visually obvious that down sampling has been taken
too far. Depending on at what point in the cycle the samples are taken, x4(n) equals a constant
(including 0), for all n.
Down-sampling
Assume that x(n) is obtained from an underlying continuous-time signal x(t) by sampling at Fx
Hz. Assume that x(t) was originally band limited to Fx/2 Hz. On the digital frequency (ω) scale
this amounts to x(n) being band limited to π.
We now wish to generate a signal y(n) by down-sampling x(n) by a factor of M, that is,
we are reducing the sampling rate by a factor of M. This amounts to:
1. Band limiting x(n) to π/M. Assume that no information is lost due to this step.
2. Down-sampling the above x(n) by a factor of M to produce y(n).
We may view y(n) as though it were generated by sampling an underlying analog signal y(t) at a
rate Fy = Fx/M Hz.
Given the signal x(n) that was obtained at a certain sampling rate the new signal y(n), the
down-sampled version of x(n), with a sampling rate that is (1/M) of that of x(n), obtained from
x(n), is given by:
y(n) = x(Mn)
and is made up of every Mth sample value of x(n); the intervening (M–1) sample values of x(n)
are dropped. This amounts to
The time between samples of y(.) is M times that between samples of x(.), or the sampling
frequency of y(.) is reduced by a factor of M from that of x(.). The block diagram of a down
sampler is shown below.
n= 0 1 2 3 4 5 6 7 8
x(n) = {1 a a2 a3 a4 a5 a6 a7 a8 . . .}
then y(n) = x(2n), with M = 2, is its 2-fold down-sampled version and is obtained by keeping
every other sample of x(n) and dropping the samples in between:
n= 0 1 2 3 4 5
y(n) = {1 a2 a4 a6 a8 a10 . . .}
In this example it is understood that the time between samples of y(n) is twice that between
samples of x(n), or, the sampling rate of y(n) is one-half of that of x(n).
Example 7.3.2 Test the system y(n) = x(Mn), where M is a constant, for time-invariance.
Solution See also Unit I. For the input x(n) the output is
→e see that (A) ≠ (B), that is, y(n–n0) and y(n, n0) are not equal. Delaying the input is not
equivalent to delaying the output. So the system is not time-invariant. In other words the down-
sampling operation is a time-varying system.
Spectrum of a down-sampled signal Given the signal x(n) whose spectrum is X(ω) or X(ejω) we
want to find the spectrum of y(n), the down-sampled version of x(n), denoted by y(n) Y(ω).
Consider the periodic train of impulses, p(n), with period M
p(n)
–M x(n) M 2M n
The discrete Fourier series representation (see Example 1 in Unit II) of p(n) is
M 1
p(n) = Pk e
j 2 k n / M
, 0 ≤ n ≤ M–1
k0
The sequence x(n) consists of values of x(n) whenever n = 0, ±M, ±2M, …, and zeros in between
those points.
p(n)
The signal y(n) consists of values of x(Mn) at n = 0, ±1, ±2, …, but no zeros in between.
With y(n) = x(Mn) = x(Mn) our objective is to find the spectrum Y(ω). Keep in mind that
X(ω) periodic in ω since x(n) is a discrete-time sequence; and the same is true of Y(ω). Now the
z-transform of y(n) is
Y(z) = y(n)z n
= x(Mn)z n
n n
Set Mn = k: then n = k/M and the summation limits n = {– ∞ to ∞} become k = {– ∞ to ∞}. Thus
Y(z) = x(k)z
k
k / M
= x(n)z
n
n / M
Here x(n) = 0 except when n is a multiple of M. Substituting x(n) p(n) for x(n) in the above
equation,
M 1
Substituting 1 e j 2 k n / M
for p(n) (from the DFS) in the above equation,
M k0
M 1 M 1
Y(z) = x(n) 1 e j 2 k n / M z n / M = 1 x(n)e j 2 kn / Mzn / M
M
M
n M k 0 k 0 n
1
x(n)e j 2 k / M z 1/ M
1 n
=
M k 0 n
= X e j 2 k / M z1/ M
X e z1/ M
M 1
j 2 k / M
= 1
M k0
1 M 1 M 1
Xe e j / M = 1 Xe
j 2 k / M
Y(ω)= Y (z) z e j = j ( 2 k ) / M
M k0 M
2k
M 1 k0
= M X M
1
k 0
0
-1
-8-6-4 -2 0 2 4 6 8
, rad/sample
Stretched by factor 2: X( /2)
1
X( /2)
0
-1
-8-6-4 -2 0 2 4 6 8
, rad/sample
And shifted by 2: X(( – 2)/2)
1
X(( – 2)/2)
0
-1
-8 -6 -4 -2 0 2 4 6 8
, rad/sample
where, for simplicity, we have used the notation X(ω) instead of X (e j ) . This expression for
Y (e j ) is a sum of M terms. Note that the function X(ω-2πk) is a shifted (by 2πk) version of
X(ω) and X(ω/M) is a stretched (by a factor M) version of X(ω). Thus Y (e j ) is the sum of M
uniformly shifted and stretched versions of X (e j ) each scaled by the factor (1/M). The shifting
in multiples of 2π corresponds to the factor (ω–2πk) in the argument of X(.), and the stretching
by the factor M corresponds to the M in (ω–2πk)/M. Note that the amount of shift is also affected
by the factor M, that is, the amount of shift doesn’t stay at 2πk but ends up being 2πk/M.
The expression for Y (e j ) contains a total of M versions of X (e j ) , one original and (M–
1) shifted replicas. Each of these is also stretched by a factor of M, so X (e j ) should have been
preshrunk, that is, band limited, to π/M before undertaking the down-sampling. Writing out the
expression for Y (e j ) in full,M we
1 have
2 k
X
j 1
Y (e )=
M k 0 M
1 2 1 2 (M 1)
= X X ... X
M M M M
1
The first term that makes up Y (e j ) , that is, X , is shown in the figure below. The figure
M M
implicitly uses M = 2. In general there will be (M–1) shifted replicas of this term.
X(ω)
ω
–3π –2π –π –π/M 0 π/M π 2π 3π
X ( / M )
M
A/M
ω
–3π –2π –π –π/M 0 π/M π 2π 3π
21
Y (e j )= 1
2 k
0
X e j ( 2 k ) / 2 =
1
2
X e j / 2 X e j (2 ) / 2
X e X e = X e X e
1 j / 2 j / 2 j
1 j /2 j /2
=
2 2
To recapitulate, before we decided to down sample X(ω) was originally band limited to π
on the digital frequency scale (that is, Fx /2 Hz). We then band limited it to π/M (that is, Fx /2M
Hz) and down sampled by a factor of M.
Aliasing Down-sampling by a factor of M, in itself, is simply retaining every Mth sample while
dropping all samples in between. If, therefore, prior to down-sampling, the signal x(n) is indeed
band-limited to π/M then we generate the down-sampled version y(n) by simply taking every Mth
sample of x(n). This process is shown below in block diagram fashion. If in this set-up x(n) is not
band-limited as required then the spectrum of y(n) will contain overlapping spectral components
of x(n) due to stretching, i.e., X / M will overlap X 2 / M , etc. This results in aliasing.
x(n) ↓M y(n)
Down sampler
Band-limiting x(n) to π/M (if not done already) is done by an anti-aliasing filter (digital
low pass filter) with a cut-off frequency of π/M. The general process of decimation then consists
of filtering followed by down sampling shown in block diagram below.
H(z)
Low pass filter
|H(ω)|
x(n) v(n) ↓M y(n)
1 Down sampler
ω
–π/M π/M
Unlike an analog anti-aliasing filter associated with an ADC, the filter in this diagram is a digital
anti-aliasing filter specified as
Note that π corresponds to Fx/2 and π/M corresponds to Fx/2M where Fx is the sampling
frequency of x(n).
Typically, in order to avoid (delay) distortion, the filter H(z) is a linear phase FIR filter
with (N+1) coefficients {h(r), r = 0 to N}. The output, v(n), of the low pass filter is then given by
convolution
N
x(n) e j n
a j n
a e
n j n
X(ω) = = e =
n n0 n0
1
= , ae j < 1
j
1 ae
This spectrum is not band-limited but we may pretend it is. This may also be obtained as X(ω)
= X (z) z e j .
x(n) y(n) = x(2n)
b) The spectrum of y(n) = x(2n)M 1
2 k
is given by ↓2
Y () = X
1
M k 0 M
2 k 1
which, with M = 2, becomes 1
Y () = X
1
= X X
2 k0 2 2 2 2
1 1 1 1 1 1
= =
2 1 ae j / 2 1 ae j (( / 2) ) 2 1 ae j / 2 1 ae j / 2e j
1 1 1 1
= =
2 1 ae j / 2 1 ae j / 2 1 a2e j
c) The Fourier transform of y(n) = x(2n) = a2 nu(2n) = a 2 nu(n) is
Y(ω) = a 2n
e j n = a 2
e j =
1
, a2e j < 1
n0 1 a2e j
d) The spectra. n
n0
15
Spectrum of x(n)
Magnitude of X1()
10
0
-4 -3 -2 -1 0 1 2 3 4
Frequency , rad/sample
6
Spectrum of x(2n)
Magnitude of X2()
0
-4 -3 -2 -1 0 1 2 3 4
Frequency , rad/sample
Up-sampling
Assume that x(n) is obtained from the continuous-time signal x(t) by sampling at Fx Hz. We now
wish to generate a signal y(n) by up-sampling x(n) by a factor of L, that is, we are increasing the
sampling rate by a factor of L. This amounts to
1. Converting x(n) to x(t) using a D/A converter.
2. Resampling x(t) at LFx Hz to produce y(n).
We may view y(n) as though it were generated by sampling an underlying analog signal y(t) (or
x(t) for that matter) at a rate Fy = LFx Hz. As in the case of down-sampling we prefer to do this
entirely in the digital domain.
Given the signal x(n) that was obtained at a certain sampling rate we can obtain a new
signal y(n) from x(n) with a sampling rate that is L times that of x(n). The signal y(n), an up-
sampled version of x(n), is given by:
and is constructed by placing (L–1) zeros between every pair of consecutive samples of x(n). The
time between samples of y(n) is (1/L) of that between samples of x(n), or the sampling frequency
of y(n) is increased by a factor of L from that of x(n). The block diagram of an up-sampler is
shown below.
n= 0 1 2 3 4 5 6 7 8
x(n) = {1 a a2 a3 a4 a5 a6 a7 a8 . . .}
then y(n) = x(n/2), with L = 2, is its 2-fold up-sampled version and is obtained by inserting a 0
between each pair of consecutive values in x(n)
n = 0 1 2 3 4 5 6 7 8 9 10
y(n) = {1 0 a 0 a2 0 a3 0 a4 0 a5 . . .}
In this example it is understood that the time between samples of y(n) is one half of that between
samples of x(n), or, the sampling rate of y(n) is twice that of x(n).
Example 5.4.2 Test the system y(n) = x(n/L), where L is a constant, for time-invariance.
→e see that (A) ≠ (B), that is, y(n–n0) and y(n, n0) are not equal. Delaying the input is not
equivalent to delaying the output. So the system y(n) = x(n/L) is not time-invariant. Therefore the
up sampler defined by
Spectrum of an up-sampled signal Given the signal x(n) whose spectrum is X(ω) or X(ejω) we
want to find the spectrum of y(n), the up-sampled version of x(n), denoted by y(n) Y(ω).
The signal y(n), with a sampling rate that is L times that of x(n), is given by:
= x(n / L) z
n 0, L, 2 L,...
n
Set n/L = k: this leads to n = kL, and the summation indices n = {0, ±L, ±2L, ±3L, …} become k
= {–∞ to ∞}, so that
Y(z) = x(k) z k L
x(k) z L k
= X z
L
=
k k
j
Setting z = e gives us the spectrum
Y (e j ) = Y (z) z e j = X ejL or Y(ω) = X(ωL)
Thus Y(ω) is an L-fold compressed version of X(ω); the value of X(.) that occurred at ωL occurs
at ω, (that is, at ωL/L) in the case of Y(.). In going from X to Y the frequency values are pushed in
toward the origin by the factor L. For example, the frequency ωL is pushed to ωL/L, the
frequency π is pushed to π/L, 2π is pushed to 2π/L, etc.
Shown below are the spectra X(ω) and Y(ω) for 2-fold up-sampling, that is, L = 2. Note
that X(ω) is periodic to start with so that the frequency content of interest is in the base range (–π
≤ ω ≤ π) with replicas of this displaced by multiples of 2π from the origin on either side. Due to
up-sampling the frequency content of X(ω) in the range (–π ≤ ω ≤ π) is compressed into the
range (–π/L ≤ ω ≤ π/L) of Y(ω), that is, into (–π/2 ≤ ω ≤ π/2), centered at ω = 0. The first replica
of X(ω) in the range (π ≤ ω ≤ 3π), centered at 2π, is compressed to the range (π/2 ≤ ω ≤ 3π/2) of
Y(ω), centered at π; its counterpart, in (–3π ≤ ω ≤ –π), centered at –2π, is compressed to (–3π/2 ≤
ω ≤ –π/2), centered at –π. If, for the purpose of discussion, we consider the range (0, 2π) as one
fundamental period then the replica in the range (π/2, 3π/2) of Y is an image (spectrum) and
needs to be filtered out with a low pass filter (anti-imaging filter) of band-width π/2. With L = 2
this is the only image in (0, 2π).
Furthermore, while the spectrum X(ω) is periodic with a period = 2π, the spectrum Y(ω),
on account of the image, is a 2-fold periodic repetition of the base spectrum in (–π/2 ≤ ω ≤ π/2);
the image spectrum is actually spurious/unwanted; further the periodicity of Y(ω) is still 2π.
X(ω)
π ω
–3π –2π –π –π/L 0 π/L 2π 3π
Y(ω)
L=2
A
π ω
–3π –2π –π –π/L 0 π/L 2π 3π
L=2
A
π ω
–3π –2π –π –π/L 0 π/L 2π 3π
These observations can be extended to larger values of L. For L = 3, for instance, there
will be two image spectra (a 3-fold periodic repetition of the base spectrum in (–π/3 ≤ ω ≤ π/3),
and the anti-imaging filter band width will be π/3.
In general, up-sampling of x(n) by a factor of L involves
Inserting L–1 zeros between successive pairs of sample values of x(n).
The spectrum Y(ω) of the up-sampled signal is an L-fold compressed version of
X(ω). As a result Y(ω) contains L–1 images and is an L-fold periodic repetition of
the base spectrum in (–π/L ≤ ω ≤ π/L).
The anti-imaging filter band width is π/L.
The over-all scheme of up-sampling is shown in block diagram below. Unlike an analog
anti-imaging filter associated with a DAC, the filter in this diagram is a digital anti-imaging
filter.
H(z)
Low pass filter
|H(ω)|
x(n) ↑L v(n) y(n)
Up sampler 1
–π/L π/L
In this diagram the pass band gain of the anti-imaging filter is shown as 1. This gain is
actually chosen equal to L to compensate for the fact that the average value of y(n) is 1/L times
the average value of x(n) due to the presence of the inserted zeros.
Note that π corresponds to Fx/2 and π/L corresponds to Fx/2L where Fx is the sampling frequency
of x(n).
The output of the low pass filter is given by the convolution sum
Now v(r) = 0 except at r = kL, where k is all integers from –∞ to ∞. Thus we have
Illustration Given the signal x(n) = {1, a, a2, a3, a4, a5, a6, a7, a8, a9, a10, …}, its 2-fold up-
sampled version is obtained by inserting a 0 between each pair of consecutive samples in x(n):
y(n) = {1, 0, a, 0, a2, 0, a3, 0, a4, 0, a5, 0, a6, 0, a7, 0, a8, 0, a9, 0, a10, …}
Intuitively, even visually, y(n) contains higher (or, more) frequencies than x(n) because of the
inserted zeros. For instance, consider the first two or three samples in each sequence. In the case
of x(n) the changes from 1 to a to a2 are smoother than the fluctuations in y(n) from 1 to 0 to a to
0 to a2; these latter fluctuations are the higher frequencies not originally contained in x(n). It is
these higher frequencies that are represented by the image in the spectrum of y(n) prior to anti-
imaging filtering. The anti-imaging filter removes or smoothes out the higher frequency
fluctuations from the up-sampled version; this smoothing is manifested in the form of the
interpolated zeros being replaced by nonzero values.
1 a = e–1/ 2 = 0.606
a
a2
a3
a4
n
0 1 2 3 4 5 6
With y(n) = x(5n/3), we evaluate y(.) for several values of n (we have assumed here that x(n) is
zero if n is not an integer):
y(0) = x(5 . 0 / 3) = x(0) = e–0/ 2 = 1
y(1) = x(5 . 1 / 3) = x(5 / 3) = 0
y(2) = x(5 . 2 / 3) = x(10 / 3) = 0
y(3) = x(5 . 3 / 3) = x(5) = e–5/ 2 = a5
…
y(6) = x(5 . 6 / 3) = x(10) = e–10/ 2 = a10
…
The general expression for y(n) can be written as
= e–5n/ 6, n = 0, 3, 6, …
0, otherwise
n = 0 1 2 3 4 5 6 7 8 9 10 11 12. . .
y(n) = {1 0 0 a5 0 0 a10 0 0 a15 0 0 a20 . .}
a5
a10
n
0 1 2 3 4 5 6
We shall recast this problem in terms of cascading the up- and down-samplers. In the
expression y(n) = x(5n/3) there is a 3-fold up-sampling and a 5-fold down-sampling. Since the
numerator 5 is greater than the denominator 3 there is a net down-sampling by a factor of 1.67
(= 5/3). Let us first do a 3-fold up-sampling of x(n) followed by a 5-fold down-sampling of the
resulting sequence. That is, given the sequence x(n)
n = 0 1 2 3 4 5 6 7 8 9 10 . .
x(n) = {1 a a2 a3 a4 a5 a6 a7 a8 a9 a10 . .}
we define yu(n) = x(n/3), and then y(n) = yu(5n) = x(5n/3). The sequences yu(n) and y(n) are given
below.
yu(n) = x(n/3)
n = 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 . .
yu(n) = {1 0 0 a 0 0 a2 0 0 a3 0 0 a4 0 0 a5 . . . .}
The net effect is that between the first two terms (1 and a5) of the final output y(.) we
have dropped four original terms and inserted two zeros.
Example 5.5.2 Given x(n) = e–n/2 u(n), find x(3n/5). Here there is a 5-fold up-sampling and a 3-
fold down sampling. Since the denominator is bigger there is a net up-sampling by a factor of
1.67.
x(n) = {1, a, a2, a3, a4, a5, a6, a7, a8, a9, a10, …}
Method A Up-sampling followed by down sampling is given below. The 5-fold up-sampled
signal, yu(n), is obtained by inserting 4 zeros shown in bold face between every pair of
consecutive samples in x(n)
yu(n) = x(n/5)
= {1, 0, 0, 0, 0, a, 0, 0, 0, 0, a2, 0, 0, 0, 0, a3, 0, 0, 0, 0, a4, 0, 0, 0, 0,
a5, 0, 0, 0, 0, a6, 0, 0, 0, 0, a7, 0, 0, 0, 0, a8, 0, 0, 0, 0, a9,
0, 0, 0, 0, a10, …}
The 3-fold down-sampled signal, y1(n), is obtained by keeping every third sample in yu(n) and
discarding the rest (shown underlined)
x(n) = {1, a, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11,…}
The 5-fold up-sampled signal, y2(n), is obtained by inserting 4 zeros shown in bold face between
every pair of samples in yd(n)
Example 5.5.3 Given that x(n) = {1, a, a2, a3, a4, a5, a6, a7, a8, a9, a10, …} is the input,
1. Find the output y1(n) of a cascade of a 2-fold up-sampler followed by a 4-fold down
sampler.
2. Find the output y2(n) of a cascade of a 4-fold down sampler followed by a 2-fold up-
sampler.
Solution Note that the down-sampling factor M = 4 and the up-sampling factor L = 2 are not co-
prime since they have a factor in common. The ratio M/L = 4/2, as given, is not in its reduced
form. As a result we do not expect that y1(n) and y2(n) will be equal. Specifically, in the first case
we have
x(n) = {1, a, a2, a3, a4, a5, a6, a7, a8, a9, a10, …}
Up-sample by inserting a zero (shown bold face) between consecutive samples of x(n) resulting
in yu(n)
yu(n) = x(n/2) = {1, 0, a, 0, a2, 0, a3, 0, a4, 0, a5, 0, a6, 0, a7, 0, a8, 0, a9, 0, a10, …}
Down-sample by keeping every fourth sample of yu(n) and discarding the three samples in
between resulting in y1(n)
x(n) = {1, a, a2, a3, a4, a5, a6, a7, a8, a9, a10, …}
Sampling Rate Conversion by a Rational Factor L/M Here the sampling rate is being
converted by a non-integral factor such as 0.6 or 1.5. That is, given x(n) with a sampling rate of
Fx we want to obtain y(n) with a sampling rate of Fy of, say, 0.6Fx (decimation) or 1.5Fx
(interpolation).
Take, for instance L/M = 3/5. Here the basic approach is to first interpolate (up-sample)
by a factor of L = 3 and then decimate (down-sample) by a factor of M = 5. The net effect of the
cascade of interpolation followed by decimation is to change the sampling rate by a rational
factor L/M, that is,
L 3 = 0.6 F .
Fy = Fx = Fx x
M
5
The corresponding signal is given by y(n) = x(5n/3), ignoring the filters involved. (This can also
be done by first down-sampling and then up-sampling).
The block diagram of the scheme where the interpolator precedes the decimator is shown
below.
Interpolator Decimator
x(n) y(n)
↑L Hu(z) Hd(z) ↓M
Fx LFx LFx LFx LFx/M
Since v(k) = 0 except at k = rL, where r is an integer between –∞ to ∞, we set k = rL. As k goes
from –∞ to ∞, r goes from –∞ to ∞, and v(rL) = x(rL/L) = x(r).
w(n) = h(n rL) v(rL) = h(n rL) x(r) = h(n kL) x(k)
r r k
In summary, sampling rate conversion by the factor L/M can be achieved by first
increasing the sampling rate by L, accomplished by inserting L–1 zeros between successive
samples of the input x(n), followed by linear filtering of the resulting sequence to eliminate
unwanted images of X(ω) and, finally, by down-sampling the filtered signal by the factor M to
get the output y(n). The sampling rates are related by Fy = (L/M)Fx. If Fy > Fx, that is, L > M, the
low pass filter acts as an anti-imaging post-filter to the up-sampler. If Fy < Fx, that is, L < M, the
low pass filter acts as an anti-aliasing pre-filter to the down-sampler.
Example 5.5.4 The signal x(t) = cos 2π2t + 0.8 sin 2π4t is sampled at 40 Hz to generate x(n).
a) Give an expression for x(n)
b) Design a sampling rate converter to change the sampling frequency of x(n) by a
factor of 2.5. Give an expression for y(n).
c) Design a sampling rate converter to change the sampling frequency of x(n) by a
factor of 0.4. Give an expression for y(n).
Solution
a) x(n) = cos 2π2nT + 0.8 sin 2π4nT = cos πn/10 + 0.8 sin πn/5
b) The rate conversion factor is L/M = 2.5 = 5/2. We do this by first up-sampling by a factor of 5,
then down-sampling by a factor of 2. Roughly speaking, y(n) = x(2n/5).
The up-sampling requires an anti-imaging LP filter of bandwidth of π/L = π/5 rad., and a
gain of 5. The down-sampling requires an anti-aliasing LP filter of band width π/M = π/2 rad.
When the up-sampler precedes the down-sampler we have the following configuration where the
filter has the smaller of the two band widths, that is, π/5 rad. The gain is 5 and is always
determined by the up-sampler.
Write equations for v(n), w(n), and y(n) based on the above diagram and assuming H(z) is
an FIR filter of N coefficients.
c) The rate conversion factor is L/M = 0.4 = 2/5. We do this by first up-sampling by a factor of 2,
then down-sampling by a factor of 5. Roughly speaking, y(n) = x(5n/2). Band width of filter =
π/5 rad., and gain = 2, once again determined by the up-sampler.
Write equations for v(n), w(n), and y(n) based on the above diagram and assuming H(z) is
an FIR filter N coefficients.
Multistage conversion The composite anti-imaging and anti-aliasing LP filter band width is π/L
or π/M whichever is smaller. That is, the filter band width is determined by the larger number of
L and M. However, if either L or M is a very large number the filter bandwidth is very narrow.
Narrowband FIR (linear phase) filters can require a very large number of coefficients (see Unit
VI, FIR Filters, Example 6). This can pose problems in
1. Increased storage space for coefficients,
2. Long computation time, and
3. Detrimental finite word length effects
The latter drawback is minimized by using a multistage sampling rate converter where the
conversion ratio L/M is factored into the product of several ratios each of which has its own
smaller L and M values. If, for instance, the ratio L/M is split into the product of two ratios
L L
L
= 1 2
M M 1 M 2
where the L’s and M’s on the right hand side are smaller, we may implement the rate conversion
in two stages as shown below
Stage 1 Stage 2
↑L1 H1(z) ↓M1 ↑L2 H2(z) ↓M2
Example 7.5.5 [Rational sampling rate converter][CD, DAT] Digital audio tape (DAT) used
in sound recording studios has a sampling rate of 48 kHz, while a compact disc (CD) is recorded
at a sampling rate of 44.1 kHz. Design a sampling rate converter that will convert the DAT
signal x(n) to a signal y(n) for CD recording.
Ha(s) = 1, 0 |F| FM
0, MFM |F| < ∞
Though this is still an ideal low pass filter in the pass band and stop band, its transition band
width is no longer zero and it may be approximated with an inexpensive first- or second-order
Butterworth filter as shown below.
0 FM MFM F, Hz
0 FM MFM F, Hz
We are paying the price of a higher sampling rate for the benefit of a cheaper analog
anti-aliasing filter. The result is a discrete-time signal that is sampled at a much higher rate than
2FM. Following the sampling operation, we can reduce this sampling rate to the minimum value
using a decimator. The resulting structure of the over-sampling ADC is shown in the block
diagram below. There are two anti-aliasing filters, a low-order analog filter Ha(s) with cut-off
frequency FM rad/sec., and a high-order digital filter Hd(z), with a cut-off frequency (π/M)
rad/sample.
Over-sampling AD converter
x(t) x(n) y(n)
Ha(s) ADC Hd(z) ↓M
M(2FM) 2FM
samples/sec samples/sec
A second benefit of using the over-sampling ADC is the reduction in quantization noise.
If q is the quantization step size (precision), then the quantization noise in x(n) is x2 = q2 12 ,
and the noise appearing in the output y(n) in the above scheme is 2 = 2 M = q2 12 M , a
y x
reduction by a factor of M.
Identities
A sampling rate converter (the M or L operation) is a linear time-varying system. On the other
hand, the filters Hd(z) and Hu(z) are linear time-invariant systems. In general, the order of a
sampling rate converter and a linear time-invariant system cannot be interchanged. We derive
below several identities, two of which are known as noble identities (viz., identities 3 and 6, all
the others being special cases), which help to swap the position of a filter with that of a down-
sampler or up-sampler by properly modifying the filter.
Recall that the input-output description of a down-sampler is
X e z1/ M Y(ejω) = 1
X e
M 1 M 1
y(n) = x(Mn) Y(z) = 1 j 2 k / M j ( 2 k ) / M
M k 0 M k0
In the structure on the left the process of generating y(.) consists of multiplying every input
sample x(.) by a and then, in the down-sampling process, dropping (M–1) of these products for
every Mth one we keep. The structure on the right is more efficient computationally: the (M–1)
samples are dropped first and every Mth is multiplied by a, that is, only the samples that are
100(M 1)
retained are multiplied. The number of multiplications is reduced by %.
M
In the structure on the left the process of generating y(.) consists of first up-sampling, that is,
inserting zeros between consecutive points of x(n) and then multiplying by a. In the process the
(L–1) zeros are also multiplied. The structure on the right is more efficient computationally: the
sequence x(n) is first multiplied and then the zeros inserted. The number of multiplications is
100(L 1)
reduced by %.
L
Identity #1 If we use the notation M{.} to mean the down-sampling of the signal in braces, then
we have
In words, the result of down-sampling the weighted sum of signals equals the weighted sum of
the down-sampled signals. In other words, the two block diagrams below are equivalent.
In the diagram on the left the weighted sum of two inputs is down-sampled:
y(n) = w(Mn)M 1
Y(ejω) = 1 W e j ( 2 k ) / M
Mk0
M 1 M 1
a
= M X e
k 0
1
j ( 2 k ) / M
+ Mb
X e
k0
2
j ( 2 k ) / M
(A)
In the diagram on the right the weighted inputs are down-sampled and added to form the
output.
M 1
y1(n) = a x1(Mn) Y1(ejω) = a
M
X e 1
j ( 2 k ) / M
k0
M 1
y2(n) = b x2(Mn) Y2(ejω) = b
M
X e 2
j ( 2 k ) / M
k0
Identity #2 A delay of M sample periods before an M-fold down-sampler is the same as a delay
of one sample period after the down-sampler.
x(n) y1(n) y(n) x(n) y2(n) y(n)
z–M ↓M ↓M z–1
Y(z) = 1
e j 2 k / M z1/ M X e j 2 k / M z 1/ M
M
M k0
M 1 M 1
e X e = 1M 1 z 1 X e j 2 k / M z1/ M
1 j 2 k M / M M / M j 2 k / M 1/ M
= z z
M k0 k0
M 1
X e z 1/ M (A)
–1 1 j 2 k / M
=z
M k0
Identity #3 (Noble identity) An M-fold down-sampler followed by a linear time invariant filter
H(z) is equivalent to a linear time invariant filter H(zM) followed by an M-fold down-sampler.
Note that the second identity is a special case of this identity with H(z) = z–1 and H(zM) = z–M.
For the system consisting of the filter followed by the down-sampler we have
z 1/ M
Y(z) = 1
Y e j 2 k / M
1
M k0
Note that
Y1 e j 2 k / M z1/ M = Y 1z
z e j 2 k / M z1 / M
= H z M
X z z e j 2 k / M z1/ M
= H e j 2 k / M z 1/ M
M
X e j 2 k / M
z 1/ M
= H e j 2 k M / M z M / M X e j 2 k / M z 1/ M
= H 1z X e j 2 k / M z1/ M = H(z) X e j 2 k / M z1/ M
Thus M 1
Y(z) = 1
H (z) X e j 2 k / M
z1/ M
M k 0
M 1
= H(z) 1
X e j 2 k / M
z 1/ M (A)
M k0
For the system consisting of the down sampler followed by the filter we have
y2(n) = x(nM)
1 M 1
Y2(z) =
M k0
X e2 k / M z1/ M
M 1
1
Y(z) = H(z) Y2(z) = H(z) (B)
M k0
X e2 k / M z1/ M
Equations (A) and (B) are identical. Thus the two systems are equivalent.
Identity #4 (This identity contains no summing junction as does identity #1.) Eventually, by
virtue of Example 6.2, the up-samplers are moved to the downstream side of the multipliers.
a a y1(n)
y1(n) v(n)
↑L
b b y2(n)
y2(n) v(n)
↑L
Identity #5 A delay of one sample period before an L-fold up-sampler is the same as a delay of L
sample periods after the up-sampler.
Y2(z) = X(zL)
Y(z) = z–L Y2(z) = z–L X(zL) (B)
Since equations (A) and (B) are identical the two systems are equivalent.
Identity #6 (Noble identity) An L-fold up-sampler preceded by a linear time invariant filter H(z)
is equivalent to a linear time invariant filter H(zL) preceded by an L-fold up-sampler. Note that
the fifth identity is a special case of this identity with H(z) = z–1 and H(zL) = z–L.
For the system consisting of the filter followed by the up-sampler we have
Y2(z) = X(zL)
Y(z) = H(zL) Y2(z) = H(zL) X(zL) (B)
Since equations (A) and (B) are identical the two systems are equivalent.
FIR implementation of sampling rate conversion
The anti-aliasing filter in a decimator and the anti-imaging filter in an interpolator may each be
either an FIR or an IIR filter, the former being preferred since it offers linear phase. We give here
the FIR implementation.
H(z)
Low pass filter
|H(ω)|
x(n) v(n) ↓M y(n)
1 Down sampler
ω
–π/M π/M
Taking the filter H(z) to be an FIR filter, the decimator is implemented as shown below,
using a direct form structure for H(z). Note that the coefficients {bi, i = 0 to (N–1)}, used in
earlier formulations, are the same as {h(i), i = 0 to (N–1)} used in this diagram. Further, the FIR
filter here is implemented with N coefficients rather than (N+1) coefficients.
z–1
h(1)
z–1
h(2)
h(N–2)
z–1
h(N–1)
The implementation equations which correspond to the above structure are
N 1 N 1
We first compute v(n) for all values of n. Then y(n) is obtained by retaining every Mth value of
v(.), dropping the intervening (M–1) values. In other words there are (M–1) computations of v(.)
that could be avoided.
We may use identity #1 to move the down-sampler to the left of the adders and the result
of Example 6.1 to move it to the upstream side of the multipliers as shown below. As a result the
100(M 1)
number of multiplications is reduced by %.
M
h(0) y(n)
x(n)
M
z–1
h(1)
M
z–1
h(2)
M
h(N–2)
M
z–1
h(N–1)
M
H(z)
Anti-imaging filter
|H(ω)|
x(n) L y(n)
Up sampler 1
ω
Taking the filter H(z) to be an FIR filter, the interpolator is implemented as shown below,
using a direct form structure for H(z). Note that the coefficients {bi, i = 0 to (N–1)}, used in
earlier formulations, are the same as {h(i), i = 0 to (N–1)} used in this diagram. Further, the FIR
filter here is implemented with N coefficients rather than (N+1) coefficients.
We shall find it more convenient to use the transposed form of the FIR filter rather than
the structure actually shown here, so here follows a digression on the transposed structure.
z–1
h(1)
z–1
h(2)
h(N–2)
z–1
h(N–1)
Start of Digression
Transposed Structure According to the transposition theorem the transposed form of a filter
has the same transfer function as the filter. The transposed form of a given filter structure is
found as follows:
1. Construct the signal flow graph of the filter.
2. Reverse the direction of arrow on every branch.
3. Interchange the inputs and outputs.
4. Reverse the roles of all nodes: an adder becomes a pick-off point and a pick-off
point becomes an adder.
If we apply this procedure to the FIR structure in the above interpolator the result is the transpose
shown below. The intermediate steps are omitted.
Original Transpose
z–1
h(1) z–1
h(1)
z–1
h(2)
z–1
h(2)
h(N–2)
z–1
z–1
h(N–1) h(N–2)
z–1
h(N–1)
Start of Aside
As an aside note that the FIR structure is simple enough that the following algebraic
manipulation can be used to proceed from the original FIR structure to the transpose structure.
Let the system function be
V (z)
= H ( z) = h(0) + h(1)z 1 + h(2) z 2 + h(3) z 3 + h(4) z 4 + … + h(N 1) z ( N 1)
U (z)
This may be rearranged as
V ( z) = H ( z)U (z)
= h(0)U (z) + h(1) z 1 U (z) + h(2) z 2 U (z) + h(3) z 3 U (z) + h(4) z 4 U (z) + …
+ h(N 1) z ( N 1) U (z)
= h(0)U(z) + z 1( h(1)U(z) + z 1 ( h(2)U(z) + z 1 ( h(3)U(z) + …
… + z 1 ( h(N 2)U (z) + z 1 h(N 1)U (z) ))))
This last equation, proceeding from right to left, performs the following in the time domain:
Multiply u(n) by h(N 1), giving h(N 1)u(n)
Delay by 1 unit, giving h(N 1)u(n 1)
Add to h(N 2) u(n) , giving h(N 2)u(n) h(N 1)u(n 1)
Delay by 1 unit, giving h(N 2)u(n 1) h(N 1)u(n 2)
Add to h(N 3)u(n) , giving h(N 3)u(n) h(N 2) u(n 1) h(N 1) u(n 2)
Delay by 1 unit, giving h(N 3)u(n 1) h(N 2)u(n 2) h(N 1)u(n 3)
…
Add to h(0) u(n)
all of which yields the implementation of the difference equation
v(n) = h(0)u(n) + h(1) u(n 1) + h(2)u(n 2) + …
…+ h(N 2) u(n N 2)+ h(N 1) u(n N 1)
Further, the equation
V ( z) = h(0)U (z) + z 1( h(1)U(z) + z 1 ( h(2)U(z) + z 1 ( h(3)U(z) + …
… + z 1 ( h(N 2)U (z) + z 1 h(N 1)U (z) ))))
also suggests the transpose structure previously developed according to the rules.
End of Aside
End of Digression
Resumption of Implementation of Interpolator Using the transposed form of the FIR filter the
structure of the interpolator appears as below:
Transpose
z–1
h(1)
z–1
h(2)
z–1
h(N–2)
z–1
h(N–1)
We may use identity #4 and the result of Example 6.2 to move the up-sampler to the right
of the multipliers as shown below. As a result the number of multiplications is reduced by
100(L 1)
%.
L
z–1
h(1)
L
z–1
h(2)
L
z–1
h(N–2)
L
z–1
h(N–1)
L
Polyphase structures
The polyphase structure for FIR Filters was developed for the efficient implementation of
sampling rate converters; however, it can be used in other applications. Further, the polyphase
structure can be developed for any filter, FIR or IIR. We give below an introduction.
Polyphase Structure for FIR Filters The impulse response of the FIR filter h(n) is of finite
length, N. The system function with N coefficients is
N 1
H(z) = h(n) z n = h(0) + h(1)z 1 + h(2) z 2 + h(3) z 3 + h(4) z 4 + … + h(N 1) z ( N 1)
n0
We shall use another parameter M: we shall divide the number of coefficients into M groups (or
branches or phases), modulo M. In other words the N terms in H(z) are arranged into M branches
with each branch containing at most Int N 1/ M 1 terms.
Type 1 polyphase decomposition For illustration, let N = 11 and M =2 so that one group
contains 6 coefficients and the other 5 as developed below:
10
Int N 1 / M h(2n 0) z n
n0
n0
h(2n 1) z n (h(11) = 0)
Int N 1/ M
(More generally, P1(z) = h(Mn 1) z
n0
n
)
x(n) y(n)
P0(z2)
z–1
P1(z2)
By observing the expressions for P0(z) and P1(z) we can further generalize the functions
Pm(z) for any m as
Int N 1/ M
Pm(z) = h(Mn m) z
n0
n
), m = 0 to (M–1)
Int N 1 / M
(More generally, P0(z) = h(Mn 0) z
n0
n
)
Int 111/ 3
h(3n 1) z n
1 2 3
P1(z) = h(1) + h(4) z + h(7) z + h(10) z =
n0
Int N 1/ M
(More generally, P1(z) = h(Mn 1) z
n0
n
)
Int 111/ 3
h(3n 1) z n
1 2
P2(z) = h(2)+ h(5) z + h(8) z = (h(11) = 0)
n0
Int N 1/ M
(More generally, P2(z) = h(Mn 1) z
n0
n
)
In this specific case we have
Y (z) = H(z) = P (z 3 )+ z 1 P (z 3 ) + z 2 P (z 3 ) = 2 z m P (z 3 )
X (z)
0 1 2 m
m0
x(n) y(n)
P0(z3)
z–1
P1(z3)
z–1
P2(z3)
Generalization As mentioned earlier, in the general case for an arbitrary M (≤ N) we have
Int N 1/ M
Pm(z) = h(Mn m) z n
, m = 0 to (M–1)
n0
and M 1
Y (z)
z
1 ( M 1)
X (z) = H(z) = P0(z ) + z P1 (z ) + … + z
M M m
PM 1 (z M ) = P
m (z
M
)
m0
x(n) y(n)
P0(zM)
z–1
P1(zM)
z–1
P2(zM)
z–1
Pm(zM)
z–1
PM–2(zM)
(M–1)th –1
z
Delay
PM–1(zM)
Type 2 polyphase decomposition Given M 1
Y (z)
z
1 ( M 1)
X (z) = H(z) = P0(z ) + z P1 (z ) + … + z
M M m
PM 1 (z M ) = P
m (z
M
)
m0
z
( M 1k )
H(z) = PM 1k (zM )
k M 1
Let
Q k(z M ) = z (M 1k ) PM 1k (z M )
This gives us the type 2 polyphase decomposition
0 M 1
k M 1
k Q k
(z M ) = Q0 (z M ) + Q1 (zM ) + … + QM 1 (zM )
k0
H(z) = z
k0
k Pk (zM )
Let
R k(z M ) = z k Pk (z M )
Example 5.8.2 For the system
6
P1(z) = h1 + h3 z1 + h5 z 2
The structure is shown below (left). As mentioned earlier P (z 2 ) and P (z 2 ) can each be
0 1
implemented as a direct form.
z–1 z–1
P1(z2) P1(z2)
The structure shown on the right is obtained by moving the delay element z 1 to the right of
P (z 2 ) these two being in series in the second phase. In this latter case the two systems P (z 2 )
1 0
2
and P1 (z ) can share the same delay elements (that is, storage locations) even though each has its
own set of coefficients, thus resulting in a canonical polyphase realization, shown below.
P0 (z 2 )
h0 h2 h4 h6
x(n) y(n)
–2 –2 –2
z z z
h1 h3 h5
z–1
P (z 2 )
1
Polyphase Structure for IIR Filters The anti-aliasing filter in a decimator and the anti-imaging
filter in an interpolator may each be either an FIR or an IIR filter. The polyphase structure can be
developed for any filter, FIR or IIR, and any finite value of M. We now proceed to the case
where h(n) is an infinitely long sequence:
H(z) = h(n) z n
n
1 branch
st
… + h(M ) z M
+ h(0) + h(M ) z M …
2 branch
nd
… + h(M 1) z M 1 + h(1) z 1 + h(M 1) z (M 1) …
… … + h(2) z 2 + h(M 2) z (M 2) …
… … … … …
ith branch … h(M i 1) z (M i1) h(i 1)z (i1) h(M i 1) z (M i1) …
… … … … …
… + h(2) z 2 + h(M 2) z (M 2) + h(2M 2) z (2M 2) …
Mth branch … + h(1) z1 + h(M 1) z(M 1) + h(2M 1) z (2M 1) …
H(z) = […+ h(M ) z M + h(0)+ h(M ) z M + h(2M ) z 2M +…] 1st row
+ […+ h(M 1) z M1+ h(1)z1+ h(M 1) z(M 1)+…] 2nd row
+ […] + …
+ […+ h(M i 1) z (M i1) + h(i 1)z (i1) + h(M i 1) z (M i1)
+ h(2M i 1) z (2M i1) +…]
…
+ […+ h(2) z 2 + h(M 2) z (M 2) + h(2M 2) z (2M 2) +…]
+ […+ h(1) z1 + h(M 1) z (M 1) + h(2M 1) z (2M 1) +…] Mth row
We factor out z 0 from the first row (branch), z 1 from the 2nd row, and, in general, z (i1) from the
ith row to get
H(z) = […+ h(M ) z M + h(0)+ h(M ) z M + h(2M ) z 2M +…] 1st row
+ z 1 […+ h(M 1) z M + h(1)+ h(M 1) z M +…] 2nd row
+ z 2 […] + …
+ z (i1) […+ h(M i 1) z M + h(i 1) + h(M i 1) z M + h(2M i 1) z 2M +…]
…
+ z(M 2) […+ h(2) z M + h(M 2) + h(2M 2) z M +…]
+ z (M 1) […+ h(1) z M + h(M 1)+ h(2M 1) z M +…]
Define
n
so that
P0( z) = […+ h(M ) z + h(0)+ h(M ) z 1 + h(2M ) z 2 +…] = h(nM ) z n
n
Similarly,
P1( z) = […+ h(M 1) z + h(1)+ h(M 1) z + h(2M 1) z +…]= h(nM 1) z n
1 2
n
In general
Pm( z) = h(nM m) z ,
n
m = 0 to (M–1)
n
H ( z) = z m Pm (z M )
m0
This is called the M-component polyphase decomposition of H(z). The M functions Pm ( z) are the
polyphase components of H(z). This overall operation is known as polyphase filtering.
As an example, for M = 3, 2
we have
Y (z) = H ( z) = z m P (z 3 ) = P (z 3 )+ z 1 P (z 3 ) + z 2 P (z 3 )
m 0 1 2
X (z) m0
Y(z) = P (z 3 ) X ( z)+ z 1 P (z 3 ) X ( z)+ z 2 P (z 3 ) X ( z)
0 1 2
This last equation leads to the structure below (left):
z–1
z–1
P1(z3)
P1(z3)
z–1
P2(z3) z–1
P2(z3)
H(z)
|H(ω)|
x(n) v(n) M y(n)
Down sampler
ω
–π/M π/M
H ( z) = z m Pm (z M )
m0
The sub filters P0 (z ) , P1 (zM ) , …, PM 1 (zM ) could be FIR or IIR depending on H(z). The block
M
z–1
P1(zM)
z–1
P2(zM)
z–1
Pm(zM)
z–1
PM–2(zM)
(M–1)th –1
Delay z
PM–1(zM)
We may use identity #1 to move the down-sampler to the immediate right of Pm (z M ) in
each branch, and then use identity #3 to move the down-sampler from the immediate right to the
immediate left of Pm (.) while at the same time changing Pm (zM ) to Pm (z) . The result appears as
below. It can be seen from this diagram that in this structure the number of multiplications is
reduced by a factor of M.
x(n) y(n)
M P0(z)
z–1
0 P1(z)
z–1
M P2(z)
z–1
M Pm(z)
z–1
M PM–2(z)
(M–1)th –1
Delay z
M PM–1(z)
****
**** Continuing with the development, comparing
Pm ( z) = h(rM m) z
r
r
we identify
pm (r) = h(rM m)
Note that M is a constant and m is a parameter. Upon substituting for Pm ( z) in the system function
M 1
H ( z) = z m P M
m (z )
m0
we have
M 1 M 1
H ( z) = z h(rM m) z
m M r
= h(rM m) z (rM m)
m0 r m 0 r
M 1
= p m (r) z (rM m)
m 0 r
Y ( z) = H ( z) X (z) = p m
m 0 r
(r) X (z) z (rM m)
The output is
M 1 M 1
= p m (r) x(n rM m)
m 0 r
Define
xm (r) = x(rM m)
Note that M is a constant and m is a parameter.
xm (r) = x(rM m)
Shifting the sequence by n units we get
xm (n r) = x(n rM m)
The output now may be written
M 1
y(n) = p m (r) xm (n r)
m 0 r
Then
M 1 M 1
z
H (z)
z
The transfer function given by above equation is slightly different from H(z). Hence the actual frequency
response will be different from desired response.
The input x(n) is obtained by sampling the analog input signal. Since the quantizer takes only fixed(discrete)
values of x(n) ,error is introduced. The actual input can be denoted by x(n) .
x(n) =x(n)+e(n)
Here e(n) is the error introduced during A/D conversion process due to finite wordlength of the quantizer.
Similarly error is introduced in the multiplication of and y(n-1) in equation(1). This is because the product
y(n-1) has to be quantized to one of the available discrete values. This introduces error. These errors generate
finite wordlength effects.
Finite Wordlength Effects in IIR Digital Filters
When an IIR filter is implemented in a small system, such as an 8-bit microcomputer, errors arise in representing
the filter coefficients and in performing the arithmetic operations indicated by the difference equation. These
errors degrade the performance of the filter and in extreme cases lead to instability.
Before implementing an IIR filter, it is important to ascertain the extent to which its performance will be
degraded by finite wordlength effects and to find a remedy if the degradation is not acceptable. The effects of
these errors can be reduced to acceptable levels by using more bits but this may be at the expense of increased
cost.
The main errors in digital IIR filters are:
i. ADC Quantization Noise:
This noise is caused by representing the samples of the input data ,by only a small number of bits.
1
ii. Coefficient quantization errors:
These errors are caused by representing the IIR filter coefficients by a finite number of bits.
iii. Overflow errors
These errors are caused by the additions or accumulation of partial results in a limited register length.
iv. Product round-off errors
These errors are caused when the output ,and results of internal arithmetic operations are rounded to the permissible
wordlength.
Finite Wordlength Effects in FFT Filters
As in most DSP algorithms, the main errors arising from implementing FFT algorithms using fixed point arithmetic
are
i. Round off errors
These errors are produced when the product W k B is truncated or rounded to the system wordlength.
ii. Overflow errors
These errors result when the output of a butterfly exceeds the permissible wordlength.
iii. Coefficient quantization errors
These errors result from representing the twiddle factors using a limited number of bits.
LIMIT CYCLES
5.2.1 Overflow oscillations
Limit Cycle: The finite wordlength effects are analyzed using the linear model of the digital systems. But
nonlinearities are introduced because of quantization of arithmetic operations. Because of these nonlinearities,
the stable digital filter under infinite precision may become unstable under finite preision.Because of this instability,
oscillating periodic output is generated.Such output is called limit cycle.The limit cycle occur in IIR filters due to
feedback paths.
Types of Limit Cycles
There are two types of limit cycles.
(1) Granular and
(2) Overflow.
1. Granular Limit Cycles
The granular limit cycles are of low amplitude. These cycles occur in digital filters when the input signal levels
are very low. The granular limit cycles are of two types. They are
i. Inaccessible limit cycles
ii. Accessible limit cycles.
2. Overflow Limit Cycles
Overflow limit cycles occur because of overflow due to addition in digital filters implemented with finite precision.
The amplitudes of overflow limit cycles are very large and it can cover complete dynamic range of the register.
This further leads to overflow causing cumulative effect. Hence overflow limit cycles are more serious than
granular limit cycles.
2
Transfer Characteristics and Example
f(v )
-1 0 1 2 v
-1
Figure: Transfer characteristics of adder having overflow limit cycles
Because of overflow limit cycle oscillations the output fluctuates between minimum and maximum values.
The above figure shows the transfer characteristic of an adder that exihibit overflow limit cycle oscillations. Here
f(v) indicates addition operation. Consider the addition of following two numbers in sign magnitude form.
7 5
x1 = 0.111 i.e., x2 = 0.101 i.e.,
8 8
2
Then
x1 + x2 = 1.010 i.e.,
8
Here overflow has occured in addition due to finite precision and the digit before decimal point makes the
number negative.
Signal Scaling:
Need for Scaling: Limit cycle oscillations can be avoided by using the nonlinear transfer characteristic. But it
introduces distortion in the output. Hence it is better to perform signal scaling such that overflow or underflow
does not occur and hence limit cycle oscillations can be avoided.
Implementation of Signal Scaling
Figure shows the direct form-II structure of IIR filter. Let the input xnbe scaled by a factor s0 before the
summing node to prevent overflow. With the scaling, the transfer function will be,
w( n )
x( n ) + + y( n )
s0
z -1
-a 1 -b 1
+ +
z -1
-a 2 -b 2
3
H ’z
s0
1 2
1 a1z a 2z
Az 1 a1z a2 z
1 2
Since
s0
H ’z
Az
W z
H ’z
Xz
Since, ’
Wz s
0
Xz Az
s Xz
W z 0
Az
(or)
1
Let Sz
Az
’, then above equation becomes,
W z s 0Sz Xz
Hence n s 0 2 S e
2 2
2 j
X e j e jnd
4
Schwartz inequality states that,
x t x tdt x t dt x t dt
2 2 2
1 2 1 2
2
d.
2
1
X e j x 2 n . Then above equation can be written as,
2
Parseval’s theorem states that
2 n0
1
2
n s
2
0 S e 2
j
d. x 2
n
2 n0
4
Here Sz Sz .S z 1 . Then we have,
2
2 n s 2 x 2 n . Sz .Sz z
1 1 1
dz
0
n0 2j
Here the integration is executed over a closed contour i.e. n s x n. Sz.Sz z
2 2 2 1 1 1
dz
0
2j C
n0
(or) 2 1 1
2
n x 2 n s 0 S z .S z z dz
n0 C
Here 2 n represents instantaneous energy of signal after first summing node. And x 2 nrepresents
instantaneous energy of input signal. Overflow will not occur if
n x 2 n
2
n0
1
Sz
Earlier we have defined . Hence above condition becomes,
Az
1 z 1dz
2j C Az .Az 1
s2 1
0
s20 1
(or) 1 z1dz
2j C Az .Az 1
5
5.3 ROUND OFF NOISE IN IIR DIGITAL FILTERS
Statistical Model for Analysis of Round-off Error Multiplication:
We perform arithmetic operations like addition and multiplication some errors will be occured. Those errors are
called arithmetic errors. The results of arithmetic operations are required to be quantized so that they can occupy
one of the finite set of digital levels. Such operation can be visualized as multiplier (or other arithmetic operation)
with quantizer at its output.
u(n) Q v(n)
v(n)
Figure: Quantization of multiplication or product
The above process can be represented by a statistical model for error analysis. The output (n) and error
e (n) in product quantization process.i.e.,
(n) (n) e (n)
The statistical model is shown below.
u( n) + v( n)
v( n)
e(n )
iii) The sequence e (n) is uncorrelated with the sequence (n) and input sequence x(n).
Computational output round off noise
Product Round-off Errors and its Reduction:
The results of product or multiplication operations are quantized to fit into the finite wordlength,when the digital
filters are implemented using fixed point arithmetic. Hence errors generated in such operation are called product
round off errors.
The effect of product Round-off errors can be analyzed using the statistical model of the quantization
process. The noise due to product round-off errors reduces the signal to noise ratio at the output of the filter.
Some times this ratio may be reduces below acceptable levels. Hence it is necessary to reduce the effects of
product round-off errors.
There are two solutions available to reduce product round-off errors.
a) Error feedback structures and
b )State space structure.
The error feedback structures use the difference between the unquantized and quantized signal to reduce
the round-off noise. The difference between unquantized and quantized signal is fed back to the digital filter
structure in such a way that output noise power due to round-off errors is reduced.
6
First Order Error-feedback Structure to reduce Round-off Error:
The results of product or multiplication operations are quantized to fit into the finite wordlength, when the digital
filters are implemented using fixed point arithmetic. Hence errors generated in such operation are called product
round off errors.
The effect of product round-off errors can be analyzed using the statistical model of the quantization
process.
Let the quantization error signal be given as the difference between unquantized signal y(n) and quantized signal
(n) .i.e.,
e(n) = y(n)- (n)
z -1
e(n )
- + +
K
x(n) + Q y(n)
v(n)
z -1
Figure: First order error feedback structure to reduce product round-off error
This error signal is fed back in the structure such that round-off noise is reduced. Such structure for first order
digital filter is shown in figure.
The incorporation of quantization error feedback as shown in figure helps in reducing the noise power at the
output . This statement can be proved mathematically.
Round-off Errors in FFT Algorithms:
FFT is used in large number of applications. Hence it is necessary to analyze the effects due to finite wordlengths
in FFT algorithms. The most critical error in FFT computation occurs due to arithmetic round-off errors.
The DFT is used in large number of applications such as filtering, correlation, spectrum analysis etc. In
such applications DFT is computed with the help of FFT algorithms. Therefore it is important to study the
quantization errors in FFT algorithms. These quantization effects mainly take place because of round-off errors.
These errors are introduced when multiplications are performed in fixed point arithmetic.
FFT algorithms require less number of multiplications compared to direct computation of DFT. But it
does not mean that quantization errors are also reduced in FFT algorithms.
2 1
x ......(1)
3N
For direct computation of DFT, the variance of quantization errors in multiplications is given as,
N
q2 .2 ......(2)
3
Here q is variance of quantization errors and is step size which is given as,
2
2b .....(3)
7
And b is the number of bits to represent one level.
Hence equation (2) becomes,
x 2
Signal to noise ratio in direct computation of DFT 2
Direct DFT
q
2b
- ......(5)
2 2
q Direct DFT .2 2b
N
N2
3
When DFT is computed using FFT algorithms, the variance of the signal remains same i.e.,
2 1
x from equation (1) ......(6)
3N
But with algorithms the variance of the quantization errors is given as,
2q FFT 2 .22b
3
2N
In the above expression, the signal to noise ration is inversely proportional to N. whereas in direct DFT
computation the signal to noise ratio is inversely proportional to N2 as given by equation (5). This means
quantization errors increase fast with increase in ‘N’ in direct computation of DFT. But in FFT algorithms the
quantization errors increase slowly with increase in ‘N’.
Product of Round-off Errors in IIR Digital Filters:
The results of product or multiplication operations are quantized to fit into the finite wordlength, when the digital
filters are implemented using fixed point arithmetic. Hence errors generated in such operation are called product
round off errors.
Product round-off error analysis is an extensive topic.Our presentation here will be brief and aims to
make you aware of the nature of the errors, their effects and how to reduce them if necessary.
The basic operations in IIR filtering are defined by the familiar second- order difference equation:
2 2
Where x(n-k) and y(n-k) are the input and output data samples,and bk and ak are the filter coefficients. In
practice these variables are often represented as fixed point numbers. Typically , each of the products bk x(n-k)
8
and ak y(n-k) would require more bits to represent than any of the operands. For example, the product of a B-bit
data and a B-bit coefficient is 2B bits long.
Truncation or rounding is used to quantize the products back to the permissible wordlength. Quantizing
the products leads to errors,popularly known as round-off errors,in the output data and hence a reduction in the
SNR. These errors can also lead to small-scale oscillations in the output of the digital filter,even when there is no
input to the filter.
x(n ) K 2B b its B b its
(a ) Q
y(n )
c( n )
Figure: Representation of the product quantization error: (a) a block diagram representation of the
quantization process; (b) a linear model of the quantization process
The figure(a) represents a block diagram of the product quantization process,and figure (b) represents a
linear model of the effect of product quantization. The model consists of an ideal multiplier,witk infinite precision,
in series with an adder fed by a noise sample, e(n), representing the error in the quantized product ,where we have
assumed,for simplicity,that x(n),y(n), and K are each represented by B bits. Thus
y(n) = Kx(n) + e(n)
The noise power, due to each product quantization, is given by
q2
2
r
12
Where r symbolizes the round-off error and q is the quantization step defined by the wordlength to which
product is quantized. The round-off noise is assumed to be a random variable with zero mean and constant
variance. Although this assumption may not always be valid, it is useful in assesing the performance of the filter.
Product of Round-off Errors on Filter Performance:
The effects of round-off errors on filter performance depend on the type of filter structure used and the point at
which the results are quantized.
The above figure represents the quantization noise model for the direct form building block. It is assumed
in the figure that the input data,x(n),output data,y(n),and the filter coefficients are represented as B-bit numbers
(including the sign bit). The products are quantized back to B bits after multiplication by rounding (or truncation).
e(n )
x( n) B b its 2B B b its B y( n)
y( n)
b0 s1 x( n)
s1
b0 s1
e1 s1
z-1 z -1
2B B B 2B z -1 z -1
b1 -a 1
s1
z -1 e2 z -1 b1 -a 1
s1
2B B B 2B z -1
z -1
b2 -a 2
s1
e3 b2 -a 2
s1
Figure: Product quantization noise model for the direct form filter section. All the noise sources in (a) have
9
been combined in (b) as they feed to the same point
Since all five noise sources, e1 to e5 in figure(a),feed to the same point (that is into the middle adder), the
total output noise power is the sum of the individual noise powers(figure(b)).
e1 e2
x(n) B
B b its w( n ) B b its x(n ) w(n )
1/s s 1b 0 y(n) 1/s 1 s 1b 0 y(n )
z-1
e 1(n ) w( n - 1 ) e 6(n )
z -1
B 2B 2B B
w (n-1)
-a 1 s 1b 1
-a 1 s 1b 1
e 3 (n ) z -1
w( n - 2 ) e 5 (n )
B 2B 2B B z -1
-b 2
-a 2 s 1b 2
w (n-2 )
e 2 (n ) e 4 (n )
-a 2 s 1b 2
Figure: Product quantization noise model for the canonic filter section. The noise sources feeding the same
point in (a) have been combined in (b)
2 5q 1 dz 2 5q
1 2
2
or
2
2
F (z)F (z ) s1 =
f (k )s1
2 2
= 5q F (z) s1
2
12 2 j c z 12 k 0 12 2
1
Where F(z) =
1 a1z a 2z2 1
f(k) = Z 1F (z) is the inverse z-transform of F(z),which is also the impulse response from each noise source to
2 q2
the filter output, . is the L2 norm squared and is the intrinsic product round-off noise power. The total
2 12
noise power at the filter output is the sum of the product round-off noise and the ADC quantization noise.
0 0 A or
2 2 2
q2 2 2
2 q2 F (z)
2
h (k ) 5s1 f (k )
= H (z) 5s 2
= 2
12
1
12 k 0 k 0
2 2
For canonic section, figure(a) , the noise model again includes a scale factor as this generates a round-off
error of its own. The noise sources e1(n) to e3 (n) all feed to the left adder, whilst the noise sources e4 (n) to
e6 (n) feed directly into the filter output. Combination of the noise sources feeding to the same point leads to the
noise model of figure(b). Assuming uncorrelated noise sources, the total noise contribution is simply the sum of
the individual noise contributions:
3q
3q 2 f 2 (k) F (z) 1
or 2
2
=
12 k 0 12 12 2
10
Where f(k) is the impulse response from the noise source e1 to the filter output, and F(z) the corresponding
transfer function given by
b0 b1 z 1 b2 z 2
F (z) s1
1 a z 1 a z2 = s1 H(z)
1 2
The total noise (ADC+round-off noises ) at the filter output is given by
2 2 2
0 0 A or
q2 s h (k)
2
H (z)
h (k) 2
q 31 s H (z)
3 1 =
2 2 2
12
1 2 2
= 1
12 2 2
k 0 k 0
f(v )
v
-1 0 1
-1
Let y r n be the output of the system after the product term 0.95 yn 1 is quantized after rounding. i.e.,
y r n Q r 0.95yn 1 x n
0.75 for n 0
Let x n
0 for n 0
Let b 4 bits are used to represent the quantized product excluding sign bit.
With n=0
11
y r n Q r 0.95y r n 1 x n
0.7510 0.112
4-bits rounded value of 0.112 will be 0.11002 i.e., 0.75 only.
yr 1 0.6875
This means the actual value of yr 1 0.7125 is changes to 0.6875 due to 4-bits quantization.
With n = 2
y r 2 Q r 0.95yr 1 x 2 Qr 0.95 0.6875 0 Qr 0.653125
0.65312510 0.1 0 1 0 0 1 1 1 0 0 1 1 0 0 1 1 0 0
Q r 0.65312510 0.1 0 1 02 upto 4 bits 0.62510
y r 2 0.625
With n = 3
y r 3 Q r 0.95y r 2 x 3 Qr 0.95 0.625 0 Qr 0.59375
yr 3 0.625
Thus y r 2 y r 3 ........ 0.625
Thus the system enters into limit oscillation when n 2 .
To calculate dead band
Consider equation
6/2
yn 1
1 a
12
1 1
Here 0.0625
b 4
2 2
0.0625/2
yn 1 1 0.95 0.625
Dead band = [-0.625, +0.625]
Signal Scaling to Prevent Limit Cycle Oscillations: This is zero input condition. Following table lists the
values of yn before and after quantization. Here the values are rounded to nearest integer value.
n yn before quantization yn after quantization
-1 12 12
0 10.8 11
1 9.72 10
2 8.748 9
3 7.8732 8
4 7.08588 7
5 6.377292 6
6 5.7395628 6
7 5.1656065 5
8 4.6490459 5
From table observe that if y1 5 , yn y1 for n 0 for zero input. Hence the dead band will be 5,5.
Since the values are rounded to nearest integer after quantization, the step size will be 1 . Hence
dead band can also be calculated as follows:
/2
yn 1 ,Here 0.9 , yn 1 1/ 2 5
1 1 0.9
Thus the dead band is 5,5.
Dynamic Range Scaling to Prevent the Effects of Overflow: The overflow can take place at some internal
nodes when the digital filters are implemented by using fixed point arithmetic. Such nodes can be inputs/outputs
of address or multipliers. This overflow can take place even if the inputs are scaled. Because of such overflow at
intermediate points,produces totally undesired output or oscillations. The overflow can be avoided by scaling the
internal signal levels with the help of scaling multipliers. These scaling multipliers are inserted at the apprppriate
points in the filter structure to avoid possibilities of overflow. Sometimes these scaling multipliers are absorbed
with the existing multipliers in the structure to reduce the total number and complexity.
At which node the overflow will take place is not known in advance. This is because the overflow
depends upon type of input signal samples. Hence whenever overflow takes place at some node, the scaling
should be done dynamically. Hence dynamic range scaling in the filter structure can avoid the effects of overflow.
Let ur (n) be the signal sample at r th node in the structure. Then the scaling should ensure that,
13
TRADE OFF BETWEEN ROUND-OFF AND OVERFLOW NOISE, MEASUREMENT OF
COEFFICIENT QUANTIZATION EFFECTS THROUGH POLE-ZERO MOVEMENT
Errors in Rounding and Truncation Operations : The computations like multiplication or addition are performed
the result is truncated or rounded to nearest available digital level. This operation introduces an error. Hence the
performance of the system is changed from expected value.
Truncation Error: This error is introduced whenever the number is represented by reduced number of bits.
Let Qt (x) be the value after truncation ,then truncation error will be,
r Qt (x) (x)
Here x is the original value of the number.
Rounding Error : This error is introduced whenever the number is rounded off to the nearest digital level.The
number of bits used to represent the rounded number are generally less than the number of bits required for actual
number.
Let Qr (x) be the value after rounding.Then rounding error will be,
r Qr (x) x
Here x is the original value of a number.
Tradeoff between roundoff and overflow noise:
Scaling operation
Scaling is a process of readjusting certain internal gain parameters in order to constrain internal signals to a range
appropriate to the hardware with the constraint that the transfer function from input to output should not be
changes.
The filter in figure with unscaled node x has the transfer function
H(z) = D(z)+F(z)G(z) ......(1)
To scale the node x, we divide F(z) by some number and multiply G(z) by the same number as in
figure. Although the transfer function does not change by this operation, the signal level at node x has been
changes. The scaling parameter can be chosen to meet any specific scaling rule such as
l2 scaling: f i
i0
2
…..(3)
Where f(i) is the unit-sample response from input to the node x and the parameter can be interpreted
to represent the number of standard deviations
D( z )
IN OUT
F(z ) x G( z )
(a )
14
D( z )
IN OUT
F(z )/ x 1 G( z )
(b )
Figure: A filter with unscaled node x and (b) A filter with scaled node x’
Representable in the register at node x if the input is unit-variance white noise. If the input is bound by
un 1 , then,
Equation represents the true bound on the range of x and overflow is completely avoided by l1 scaling in (2),
which is the most stringent scaling policy.
In many cases, input can be assumed to be white noise. Although we cannot compute the variance at node
x. for unit-variance white noise input,
E x2n f 2i .....(5)
i0
Since most input signals can be assumed to be white noise, l2 scaling is commonly used. In addition, (5) can be
easily computed. Since (5) is the variance (not a strict bound), there is a possibility of overflow, which can be
reduced by increasing in (3). For large values of , the internal variables are scaled conservatively so that no
overflow occurs. However, there is a trade –off between overflow and roundoff noise, since increasing deteriorates
the output SNR (signal to noise ratio).
a
8 bits
15 bits
u( n) + x( n)
D
u(n) + x(n )
D
8 bits
(ro u n d o ff e rro r)
Figure: Model of roundoff error
Roundoff Noise: If two W-bit fixed point fraction numbers are multiplies together, the product is (2W-1) bit
long. This product must eventually be quantized to W-bits by rounding or truncation. For example, consider the
1st –order IIR filter shown in figure. Assume that the input wordlength is W=8bits. If the multiplier coefficient
wordlength is also the same, then to maintain full precision in the output we need to increase the output wordlength
by 8 bits per iterations. This is clearly infeasible. The alternative is to roundoff (or truncate) the output to its
nearest 8-bit representation.
15
P e(X )
x
Figure: Error probability distribution
The result of such quantization introduces roundoff noise e(n). For mathematical ease a system with
roundoff can be modeled as an infinite precision system with an external error input. For example in the previous
case (shown in figure) we round off the output of the multiply add operation and an equivalent model is shown in
figure.
Although rounding is not a linear operation, its effect at the output can be analyzed using linear system
theory with the following assumptions about e(n):
1. E(n) is uniformly distributed white noise.
2. E(n) is a wide –sense stationary random process, i.e., mean and covariance of e(n) are independent of the
time index n.
3. E(n) is uncorrelated to all other signals such as input and other noise signals.
Let the wordlength of the output be W-bits, then the roundoff error e(n) can be given by
2w1 2 w1
en .....(6)
2 2
Since the error is assumed to be uniformly distributed over the interval given in (6), the corresponding
probability distribution is shown in figure, where is the length of the interval (i.e., 2w1 ).
Let us compute the mean E[e(n)] and variance E e 2 n of this error function.
1x
Een 2
xP xdx 2 2 0
2
e
2
.....(7)
2
e
3
…...(8)
2 2 12 3
b CT
u(n) x(n+ 1) z -1 x(n) y(n)
e(n )
16
Figure: Signal flow graph
In other words (8) can be rewritten as
2w
2 2 ......(9)
e
3
Where 2e is the variance of the roundoff error in a finite precision, W-bit wordlength system. Since the
variance is proportional to 22w , increase in wordlength by 1 bit decreases the error by a factor of 4.
The purpose of analyzing roundoff noise is to determine its effect at the output signal. If the noise
variance at the output is not negligible in comparison to the output signal level, the worlength should be increase
or some low noise structures should be used. Therefore, we need to compute SNR at the output, not just the noise
gain to the output. In the noise analysis, we use a double length accumulator model, which means rounding is
performed after two (2w-1)-bit products are added. Also, notice that multipliers are the sources for roundoff
noise.
Effects of Coefficient Quantization in FIR filters: Let us consider the effects of coefficient quantization in FIR
filters. Consider the transfer function of the FIR filter of length M,
M 1
H(z) = h(n)z
n
n0
The quantization of h(n) takes place during implementation of filter. Let the quantized coefficeints be
denoted by h(n) and e(n) be the error in quantization. Then we can write,
h(n) = h(n)+e(n)
And the new filter transfer function becomes,
M 1 M 1 M 1 M 1
H (z) h(n)z
n0
n
= h(n) e(n)z
n0
n
= h(n)z
n0
n
e(n)z n = H(z)+E(z)
n0
M 1
E(z)= e(n)z
n
Where,
n0
H( z )
H( z )
E( z )
17
H () H () E()
Here E() is the error in the desired frequency response which is given as,
M 1
E( ) = e(n)e
jn
n0
The upper bound is reached if all the errors have same sign and have the maximum value in the range. If
we consider e(n) to be statistically independent random variables, then more realistic bound is given by standard
derivation of E( ) i.e.;
DEADBAND EFFECTS
Deadband and Deadband of First Order Filter: Dead band is the range of output amplitudes over which limit
cycle oscillations take place
Dead band of first order filter
Consider the first order filter,
Here yn 1 is the product term. After rounding it to ‘b’ bits we get,
The error due to rounding is less than . Hence,
2
Qyn 1 yn 1
2
From equation (1) above equation can be written as,
yn 1 yn 1
2
yn 11
2
/2
yn 1
1
18