Sie sind auf Seite 1von 65

Introduction to Signal Processing

Dr. Kaminski Jeremy lecture notes by Levy Tal


HiT,Holon, Israel
November 17, 2008

1 Classification of signals
A signal is a function representing a physical quantity or variable,
and typically it contains information about the behavior or nature
of the phenomenon.
Mathematically, a signal is represented as a function of an independent
variable t. Usually t represents time. Thus, a signal is denoted by x(t).
Mainly we talk about continuous-time and discrete-time signals.
A signal x(t) is a continuous-time signal if t is a continuous variable.
Continuous-time signals are also known as analog signals.
If t is a discrete variable, that is, x(t) is defined at discrete times, then x(t)
is a discrete-time signal. A discrete time signal is often denoted by {xn } or x[n],
where n = integer. Discrete-time signals are also known as digital signals.

1.1 Energy and power


Definition 1 Given an arbitrary signal the instantaneous power of the signal
2
is defined as |x(t)| .

Definition 2 The average power in a given interval of a signal is defined as


Z T2
1 2
P = |x(t)| dt
T2 − T1 T1

for a continuous-time signal and as


n2
1 X 2
P = |x[n]|
n2 − n1 n=n
1

for a discrete-time signal.

1
The normalized average power, then, is simply defined as
Z T
1 2
P = lim |x(t)| dt
T →∞ 2T −T

for a continuous-time signal and as


N
1 X 2
P = lim |x[n]|
N →∞ 2N + 1
n=−N

for a discrete-time signal.

Definition 3 The energy in a given interval of a signal is defined as


Z T2
2
E= |x(t)| dt
T1

for a continuous-time signal and as


n2
X 2
E= |x[n]|
n=n1

for a discrete-time signal.

The normalized energy content, then, is simply defined as


Z ∞
2
E= |x(t)| dt
−∞

for a continuous-time signal and as


X 2
E= |x[n]|
n∈Z

for a discrete-time signal.

Definition 4 A signal is said to be an energy signal if and only if 0 < E < ∞.


Moreover, for any energy signal, P = 0.

A signal is said to be a power signal if and only if 0 < P < ∞.


In that case the energy is infinite.

2
1.2 Periodic signals
Definition 5 A continuous-time signal is said to be periodic with period T if
there is a positive nonzero value of T for which

∀k ∈ Z, ∀t, x(t + kT ) = x(t)

A discrete-time signal is periodic with period N if there is a positive integer N


for which
∀k ∈ Z, ∀n ∈ Z, x[n + kN ] = x[n]

Periodic signals are power signals, and the normalized average power can be
computed over one period.
Z T
1 2
P = |x(t)| dt
T 0

for an analog signal, or:


N −1
1 X 2
P = |x[n]|
N n=0
for a digital signal.

1.3 Convergence
For any given sequence of functions {xn (t)} so that ∀n, xn (t) : I → E with the
limit function x(t) we can define the following:

Definition 6
Convergence at a given point
∀ > 0, ∃n0 ∈ N : ∀n > n0 ⇒ |xn (t) − x(t)| < 
Uniform convergence
∀ > 0, ∃n0 ∈ N : ∀n > n0 , ∀t ∈ I ⇒ |xn (t) − x(t)| < 

Definition 7 It is said that a sequence of continuous functions {xn (t)}


converges energy wise to a continuous function x(t) if:
R 2
∀ > 0, ∃n0 ∈ N : ∀n > n0 ⇒ I |xn (t) − x(t)| dt < 

3
2 L1 and L2 spaces
Definition 8 A given set A ⊂ R is said to be a null set if
∀ > 0, ∃{In } (a series of lengths) so:

S
• A ⊂ n∈N In
P
• n∈N length(In ) < 

Definition 9 It is said that a property holds almost everywhere if the set of


elements for which the property does not hold is a null set.

Definition 10 Lets denote L1 (I) (where I ⊂ R) as:


Z
1
L (I) = {f (t) : |f (t)|dt < ∞, t ∈ I}
I

and we identify two functions that are equivalent almost everywhere.


(meaning they belong to the same equivalence class).

Definition 11 Lets denote L2 (I) (where I ⊂ R) as:


Z
2
L2 (I) = {f (t) : |f (t)| dt < ∞, t ∈ I}
I

and we identify two functions that are equivalent almost everywhere.


The inner-product in L2 (I) is defined as:
Z
< f, g >= f (t)g(t)dt
I

and the norm (under the given inner-product) is defined as :


sZ
2
kf k = |f (t)| dt
I

From the last definition we observe that energy-wise convergence is convergence


under that specific norm.

Definition 12 Two functions are said to be orthogonal if :

< f, g >= 0

Example
I = (0, T0 )
{fn } : I → R, t 7→ cos( 2Πnt
T0 )
{gn } : I → R, t 7→ sin( 2Πnt
T0 )
It is clear that
cos( 2Πnt 2Πnt
R
∀m, n 6= 0, < fn , gn >= I T0 )sin( T0 )dt = 0
∀n, ∀m 6= n, < fn , fm >= 0
∀n, ∀m 6= n, < gn , gm >= 0

4
Definition 13 Let H be a subspace of L2 (I). It is said that the series {ϕn }
is an orthonormal basis if:

• {ϕn } is a basis in H.
• ∀n, ∀m 6= n, < ϕn , ϕm >= 0
• ∀n, kϕn k = 1

Theorem 14 Let H be a subspace of L2 (I), and {ϕn (t)} an orthonormal


basis in H. then :
P
∀f (t) ∈ H f (t) = n < f (t), ϕn (t) > ·ϕn (t)

5
3 Fourier series
Let H be a subspace of L2 (I), where I = (0, T ) ⊂ R. The following set of
functions {f0 , fn , gn } is an orthonormal basis in H when:
f0 : I → R t 7−→ √1
T
fn : I → R t 7−→ √2 cos( 2Πnt
T T ), n > 0

gn : I → R t 7−→ √2 sin( 2Πnt


T T ), n > 0

P∞ 2Πnt
Definition 15 ∀x(t) ∈ H, x(t) = a0 + n=1 (an cos( T ) + bn sin( 2Πnt
T )),
Where
RT
a0 = T1 · 0 x(t)dt
RT
an = T2 · 0 x(t) · cos( 2Πnt
T )dt
2
RT 2Πnt
bn = T · 0 x(t) · sin( T )dt

Another (sometimes more practical) way to denote x(t) would be :


P∞
x(t) = a0 + n=0 (hn (t)), where
hn (t) = (an cos( 2Πnt 2Πnt 2Πnt
T ) + bn sin( T )) = An · sin( T + ψn )
 2 2 2
 An = an + bn
f or
 tan(ψ ) = an
n bn

The energy content of each element in this series is calculated as follow :


2
kh0 (t)k = T · a20 = T · A20
2 T
khn (t)k = T /2 · (a2n + b2n ) = 2 · A2n , ∀n ≥ 1

One more set of function that is a basis in H is the set of complex exponential
2πint
functions ϕn (t) = {e T } and ∀x(t) ∈ H,
2πint RT −2πint
x(t) = n∈Z Cn e T , Where: Cn = T1 · 0 x(t)e T dt
P
an −ibn
Cn = 2 , n≥0
an +ibn
C−n = 2 , n≥0

The energy content of each element in this series is denoted by :


P 2
E = T · n∈Z |Cn |

3.1 Convolution
In mathematics convolution is a mathematical operator which takes two func-
tions x and h and produces a third function that, in a sense, represents the
amount of overlap between x and a reversed and translated version of h.
The importance of the convolution operation in LTI (Linear, Time Invariant)
systems (which will be discussed further on) stems from the fact that knowledge

6
of the response of an LTI system to the unit impulse input allows us to find its
output to any input signals.
In general, given a signal x and a system h, the operation of the system on the
signal is the convolution of x and h.

Definition 16 The convolution of two continuous-time signals x(t) and h(t) is


denoted by: Z
(x ∗ h)(t) = x(t − τ ) · h(τ )dτ
R

The convolution of two discrete-time signals x[n] and h[n] is denoted by:

X
(x ∗ h)(n) = x(n − k) · h(k)
k=−∞

3.1.1 Properties of the convolution integral


1. Commutative: (x ∗ h)(t) = (h ∗ x)(t)

2. Associative: (x ∗ h) ∗ g = x ∗ (h ∗ g)
3. Distributive: (x + h) ∗ g = x ∗ g + h ∗ g
4. Differentiability: (x ∗ h)0 = x0 ∗ h = x ∗ h0

7
4 Fourier Transform
Fourier transform converts time-domain signals into frequency-domain
(or spectral) representations. In addition to providing spectral representations
of signals, Fourier analysis is also essential for describing certain types of systems
and their properties in the frequency domain.

4.1 From Fourier series to Fourier Transform


Let H be a subspace of L2 (I), where I = (0, T )
The complex exponential Fourier series of x(t) ∈ H is given by
2πint
X
x(t) = Cn e T (1)
n∈Z

where Z T
1 −2πint
Cn = · x(t)e T dt
T 0
Since (in our course) we consider all signals to be finite signals (i.e. x(t) = 0
outside a given interval - I) we can rewrite the above equation
Z ∞
1 −2πint
Cn = · x(t)e T dt
T −∞
R∞
Let us define T = u and X(u) = −∞ x(t)e−2πiut dt.
1

Therefore we get
1
Cn = · X(nu) (2)
T
Substituting Equation (2) in (1) yields
X 1
x(t) = · X(nu)e2πinut
T
n∈Z
X
x(t) = X(nu)e2πinut · u (3)
n∈Z
As T → ∞ u → 0 , thus
X
x(t) = lim x(t) = lim X(nu)e2πinut · u
T →∞ u→0
n∈Z

And finally resulting in Z


x(t) = X(u)e2πiut du
R

Definition 17 The function


Z ∞
X(u) = x(t)e−2πiut dt
−∞

Is defined as the Fourier Transform of x(t), and


Z
x(t) = X(u)e2πiut du
R

Is defined as the Inverse Fourier Transform of X(u).

8
X(u) is usually denoted as F[x(t)](u) or X(u) or x̂(u).
x(t) can be expressed as F −1 [X(u)](t) .

4.2 Properties of Fourier Transform


Lets denote F[x(t)](u) = X(u) then:
1. Linearity: F[αx1 + βx2 ](u) = αF[x1 ](u) + βF[x2 ](u).
2. Time reversal: F[x(−t)](u) = X(−u).

3. Complex conjugate: F[x(t)](u) = X(−u).


1 u
4. Time scaling: α > 0, F[x(αt)](u) = α X( α ).

5. Time shifting: F[x(t − t0 )](u) = X(u) · e−2πiut0 .


Notice: Time shifting results in a phase change. This subject will be
discussed later.
6. Frequency Shifting: F[x(t · e2πitu0 )](u) = X(u − u0 ).
7. Modulation: F[x(t) · cos(2πtu0 )](u) = 21 (X(u − u0 ) + X(u + u0 )).
F[x(t) · sin(2πtu0 )](u) = 12 (X(u − u0 ) − X(u + u0 )).
The Fourier transform X(u) of x(t) is, in general, complex, and it can be
expressed as |X(u)| · e2πiψ(u) , or A(u) + iB(u) where :
p
|X(u)| - amplitude spectrum of x(t) = A2 (u) + B 2 (u) .
ψ(u) - phase spectrum of x(t) = arctan( B(u)
A(u) ).

If x(t) is a real signal, then from the third property we get X(u) = X(−u)

so |X(u)| = X(−u) and ψ(u) = −ψ(−u).

Hence, the amplitude spectrum |X(u)| is an even function and the phase
spectrum ψ(u) is an odd function of u .

Additional properties
(for F[x(t)](u) = X(u))
8. Differentiation in the Time Domain: F[x0 (t)](u) = 2πuX(u)
9. Convolution: Given that F[x(t)](u) = X(u) and F[h(t)](u) = H(u)
then F[(x ∗ h)(t)](u) = X(u) · H(u)

10. Multiplication: Given that F[x(t)](u) = X(u) and F[h(t)](u) = H(u)


then F[(x(t) · h(t)](u) = (X ∗ H)(u)
11. The Fourier transform of an even signal x(t) is a real function of u.
The Fourier transform of an odd signal x(t) is a pure imaginary function
of u.
R∞ 2
Earlier we defined E = −∞ |x(t)| dt as the normalized energy content of x(t)

9
Theorem 18 (Parseual’s theorem/energy theorem)
Z ∞ Z ∞
2 2
E= |x(t)| dt = |X(u)| du
−∞ −∞
2
|X(u)| is often referred to as the spectral energy-density of x(t).
The higher the energy-density for a given frequency u0 the higher its weight in
x(t).

Proof
Z Z Z Z Z Z
2 −2πiut
|X(u)| du = X(u)X(u)du = ( x(t)e )X(u)dtdu = x(t)dt X(u)e−2πiut du =
R R R R R R
Z Z Z Z
2
= x(t)dt X(u)e2πiut du = x(t)x(t)dt = |x(t)| dt
R R R R

4.3 Signals similarity (auto correlation)


Definition 19 The joint energy of two signals is given by
Z
Ex,h = x(t)h(t)dt = < x, h >
R

The higher the joint energy is, the bigger the similarity between the two signals.

X(u)H(u) is said to be the joint spectral energy-density.

From the last definition we obtain that the joint energy isn’t the best tool to
measure similarity between two signals. Given the signals x(t) where
x(t) = 0, ∀t ∈
/ [a, b] and h(t) = x(t − b) the joint energy equals zero even though
the two signals are identical.
Therefore we need another way to measure similarity.
Definition 20 The cross-correlation between two signals is a function defined
as Z
τ :R→R x(t + τ )h(t)dt = Rx,h (τ )
R

So we can now more accurately say The higher the correlation, the bigger the
similarity between the two signals.

Notice: Rx,h (0) = Ex,h .


The Fourier Transform of Rx,h (τ ) is - X(u)H(u), which was defined earlier as
the joint spectral energy-density.

Proof
Z Z Z Z Z
F[Rx,h ](u) = Rx,h e−2πiuτ dτ = ( x(t+τ )h(t)dt)e−2πiuτ dτ = h(t)dt x(t+τ )e−2πiuτ dτ =
R R R R R
Z Z Z Z Z Z
−2πiu(y−t) −2πiuy
h(t)dt x(y)e dy = h(t)dt 2πiut
e x(y)e dy = h(t)e 2πiut
dt x(y)e−2πiuy dy =
R R R R R R
Z Z
h(t)e−2πiut dt x(y)e−2πiuy dy = H(u)X(u)
R R

10
4.4 Dirac delta function - The unit impulse function
The function part of its name might be confusing but the Dirac delta function
is a generalized function .

Definition 21 The Dirac delta function is denoted δ(t) and mathematically it


is defined by Z ∞
δ(t)x(t)dt = x(0)
−∞

where x(t) is any regular function continuous at t = 0.


Properties
R
1. R
δ(t)dt = 1.
R
2. R
δ(t − a)x(t)dt = x(a). We will denote δ(t − a) as δa (t).
1
3. δ(at) = |a| δ(t).

4. δ(−t) = δ(t).
5. (x ∗ δa )(t) = x(t − a).
Conclusions

R
• x(t) = R
x(τ )δ(t − τ )dτ = (x ∗ δ)(t).
• The convolution (x ∗ δa )(t) results in shifting x(t) by the value a.
The Fourier transform of δ(t) is easily calculated to be:
Z
F[δ(t)](u) = δ(t)e−2πiut dt = 1
R
Using the inverse transform we can write
Z
−1
F [1](t) = δ(t) = e2πiut du
R
and therefore getting two more important identities:
1. F[δa (t)](u) = e−2πiua

2. F[e2πiat ](u) = δa (u)


Example
Calculate the Fourier transform of x(t) = cos(2πat).
Answer
x(t) = cos(2πat) = 21 [e2πiat + e−2πiat ], hence,

1 1
F[x(t)](u) = (F[e2πiat ](u) + F[e−2πiat ](u) = (δ(u − a) + δ(u + a))
2 2

11
Definition 22 A Dirac comb (also known as an impulse train or sampling
function) is a periodic function, constructed from Dirac delta functions, with a
period T as an interval between them.
We shall denote Dirac’s comb by ∆T (t) or ΠT (t).
X
∆T (t) = ΠT (t) = δ(t − nT )
n∈Z

The Fourier transform of Dirac’s comb is calculated as follow:


Z XZ X
F[∆T (t)](u) = ∆T (t)e−2πiut dt = δ(t − nT )e−2πiut = e−2πiunT
R n∈Z R n∈Z

Since the Dirac comb function is periodic (with the period T), it can be
represented as a Fourier series:
n
X
∆T (t) = cn e2πit T
n∈Z

where
Z T Z T
1 2 n 1 X 2 n
cn = ∆T (t)e−2πit T dt = δ(t − nT )e−2πit T dt =
T − T2 T − T2
n∈Z

Z T
1 2 1
= δ(t)dt =
T − T2 T
yielding
1 X 2πit n
∆T (t) = e T
T
n∈Z

e2πitnT or:
P
From the last equation we can learn that ∆ T1 (t) = T n∈Z
X
∆ T1 (u) = T e2πiunT
n∈Z

and from the Fourier transform we know that


X
F[∆T (t)](u) = e−2πiunT
n∈Z

thus getting the following identity


1
F[∆T (t)](u) = ∆ 1 (u)
T T
meaning that the Fourier transform of a Dirac comb is also a Dirac comb, where
the time interval T in the time domain becomes a T1 interval in the frequency
domain.

12
5 Systems and Filters
A system is a mathematical model of a physical process that relates the input
signal to the output (or response) signal.
If the input and output signals are continuous-time signals, then the system is
called a continuous-time system. If the input and output signals are discrete-
time signals or sequences, then the system is called a discrete-time system.
A system is represented as a transformation of x(t)/x[n] to y(t)/y[n].
The mathematical notation is y = S(x), where S is viewed as an operator
representing some well-defined rule by which x is transformed into y.

5.1 Classification of systems


1. A system is called causal if its output at an arbitrary time t = t0 , depends
only on the input for t ≤ t0 . That is, the output of a causal system at
the present time depends on only the present and/or past values of the
input, not on its future values.
2. A system is called linear if it obtains
• Additivity: S(x1 + x2 ) = S(x1 ) + S(x2 ).
• Homogeneity (or Scaling): S(αx1 ) = αS(x1 ).

3. A system is called time-invariant if a time shift (delay or advance) in the


input signal causes the same time shift in the output signal.
4. If the system is linear and also time-invariant, then it is called a linear
time-invariant (LTI) system.
5. A system is bounded-input/bounded-output (BIBO) stable, if for any
bounded input x defined by |x| ≤ M the corresponding output y is also
bounded defined by |y| ≤ N , where M and N are finite real constants.

5.2 LTI systems


Two most important attributes of systems are linearity and time-invariance. It
will be shown that the input-output relationship for LTI systems is described in
terms of a convolution operation. The importance of the convolution operation
in LTI systems stems from the fact that knowledge of the response of an LTI
system to the unit impulse input allows us to find its output to any input signals.

Definition 23 The impulse response h(t)/h[n] of a continuous-time/discrete-


time LTI system is defined to be the response of the system when the input is
the unit impulse (Dirac delta).

Theorem 24 The output of a LTI system to an arbitrary input x(t), is defined


by the convolution integral between the input x(t) and the impulse response h(t).
that is
y(t) = (x ∗ h)(t) or y[n] = (x ∗ h)[n]

13
Proof
R
We know that x(t) = (x ∗ δ)(t) ⇔ R x(t − τ )δ(τ )dτ . Suppose y(t) = S(x),
where S is a LTI system then we get:
Z
y(t) = S( x(t − τ )δ(τ )dτ )
R

Using the linearity property


Z Z Z
S( x(t−τ )δ(τ )dτ ) = S(x(t−τ )δ(τ ))dτ → (t−τ = y) = S(x(y)δ(t−y))dy
R R R

Note: S is a system that depends only on the variable t therefore using linearity
again
Z Z Z
S(x(y)δ(t − y))dy = x(y)S(δ(t − y))dy = x(y)h(t − y)dy = (x ∗ h)(t)
R R R

5.3 Filters
The term filter is often used to refer to a discrete-time system. A digital filter
is defined as a “. ..computational process or algorithm by which a sampled
signal or sequence of numbers (acting as the input) is transformed into a second
sequence of numbers termed the output signal. The computational process may
be that of low-pass filtering (smoothing), bandpass filtering, interpolation, the
generation of derivatives...” (by J. E Kaiser ).
Filters may be characterized in terms of their system properties, such as
linearity, time-invariance, causality and stability, and they may be classified in
terms of the form of their frequency response.

A LTI system is also called a Filter. Three main filters are


1. Low Pass Filter (LPF-cuts off high frequencies).
2. Band Pass Filter (cuts off high and low frequencies).

3. High Pass Filter (HPF-cuts off low frequencies).


Other important kinds of filters are Linear phase filters and All-pass filters.
An example for a HPF would be a system that derives the signal, while an
−t2
1
example for a LPF would be h(t) = Ce
σ2 , (where C is constant).

14
6 Sampling
Most discrete-time signals come from sampling a continuous-time signals. The
process of converting these signals into digital form is called analog-to-digital
(A/D) conversion. The reverse process of reconstructing an analog signal from
its samples is known as digital-to-analog (D/A) conversion.
An A/D converter transforms an analog signal into a digital sequence. The
input xc (t), is a real continuous signal/function .
The output of the A/D is a bit stream that corresponds to a discrete-time
sequence, x[n], with an amplitude that is quantized, for each value of n, to one
of a finite number of possible values.

Definition 25 Sampling is the reduction of a continuous-time signal to a discrete-


time signal.
Mathematically speaking, given a continuous-time signal x(t) denoted xc (t)
X
xd (t) = xc (t) · ∆T (t) = xc (nT )δ(t − nT ) (c − continuous, d − discrete).
n∈Z

Therefore the sampled signal xd (t) is


 P
xd (t) = n∈Z xc (nT )δ(t − nT ) if t ∈ ZT
0 if t ∈
/ ZT

The sampling frequency or sampling rate fs is defined as the number of samples


obtained in one second, or fs = T1 . The sampling rate is measured in Hertz or
in samples per second.
We can now ask: under what circumstances is it possible to reconstruct the
original signal completely with no loss of information ?
Before answering let us look at the Fourier transform of xd (t).

F 1 1 X n
xd (t) = xc (t) · ∆T (t) → Xd (u) = (Xc ∗ ( ∆ T1 ))(u) = Xc (u − )
T T T
n∈Z

note:

signal x(t) the operation (x ∗ ∆T )(t) yields a new


Given an arbitrary P
function (/signal) n∈Z x(t − nT ). This new function is periodic
with period T .
Clearly Xd (u) is a periodic signal with period T1 (in the frequency domain),
since xc (t) is a real signal the amplitude spectrum of Xd (u) is an even function,
1 1
thus, a full cycle spans between − 2T to 2T on the frequency axis.

15
Figure 1: Magnitude of Xd (u)

1
If the frequency content of xc (t) ranges from u1 to u2 and if 2T ≥ u2 then
reconstruction is doable without any loss of information.
1
If 2T < u2 then we can not reconstruct the original signal xc (t) and the area
1
between 2T to u2 is called ’aliasing’.

Definition 26 Aliasing refers to an effect that causes different continuous


signals to become indistinguishable (or aliases of one another) when sampled.

Figure 2: Aliasing

Theorem 27 Nyquist - Shannon sampling theorem


Given an arbitrary real signal x(t) so that ∃M > 0, ∀u : |u| > M ⇒ X(u) = 0
1
then x(t) can be reconstructed from xd (t) when T ≤ 2M or fs = T1 ≥ 2M .
fs (sampling rate) is also called Nyquist rate.

Therefore given Xd (u), Xc (u) can be retrieved by

Xc (u) = Xd (u) · R 2T
1 (u)

where
1

1 if |u| < 2T
1 (u) =
R 2T
0 otherwise

16
Figure 3:

Summary
So far we’ve learned that in order to sample a continuous signal x(t) it must be

considered as a finite signal (sampling is only done over a finite period of time).

furthermore, its frequency content must be finite as well (i.e given x(t) and X(u)

being its Fourier transform, X(u) = 0, ∀u after a certain value of u = M ).

M will determine the sample rate needed in order not to loose any information

during the process (Nyquist rate).

Therefore given an infinite signal x(t) its sampling process will follow:

xc(t) → Windowing → LPF → Sampling → xd(t)


Windowing - can be done by multiplication with a “window” function
such as RT (t).

LPF - This will make sure there are no “frequencies” higher then a given
value u = M .

More about window functions and filters in the following sections.

17
7 DFT - Discrete Fourier Transform
The discrete Fourier transform (DFT) is one of the most common, and power-
ful, procedures encountered in the field of digital signal processing. The DFT
enables us to analyze, manipulate, and synthesize signals in ways not possible
with continuous (analog) signal processing.
The DFT is a mathematical procedure used to determine the frequency, content
of a discrete signal sequence.
As said earlier, given an arbitrary continuous signal xc (t), it can be sampled
into a discrete signal
X
xd (t) = xc (t) · ∆T (t) = xc (nT )δ(t − nT )
n∈Z

Since we assume xc (t) is a finite signal, the number of samples that


xc (nT ) 6= 0 is finite. Assume we get N samples the last equation turns into
PN −1
xd (t) = n=0 xc (nT )δ(t − nT ).

Calculating Fourier transform for this last expression we get:


N
X −1
x
cd (u) = xc (nT ) · e−2πinuT
n=0

1
where x
cd (u) = x
cd (u + T ).

Note that u is a continuous variable, therefore in order to store that


information on a computer, we need to “sample” the Fourier Transform,
obtaining the DFT.
−1
Definition 28 {Xk }N cd (u) over [0, T1 ] is defined as the DFT
k=0 , N samples of x
of xc (t) if:
N −1
X −2πink k
Xk = x[n] · e N =x
cd ( ), k = 0, 1 . . . , N − 1
n=0
NT

It must be stated that DFT contains all the information that lies in x
cd (u).
Without loss of generality we will from now on decide T = 1.

Definition 29 The Inverse Discrete Fourier Transform (IDFT) is given as


follow :
N −1
1 X 2πink
x[n] = Xk · e N
N n=0

Note that the DFT actually samples the Fourier transform of xd (t).
The frequencies analyzed (meaning - sampled) are

k · fs k k
uanalyzed = = = , k = 0, 1, 2, . . . , N − 1
N TN N

18
7.1 DFT leakage
As it turns out, the DFT of sampled real-world signals provides frequency-
domain results that can be misleading. A characteristic, known as leakage,
causes our DFT results to be only an approximation of the true spectra of the
original input signals prior to digital sampling. Although there are ways to
minimize leakage, we can’t eliminate it entirely. Thus, we need to understand
exactly what effect it has on our DFT results.
DFT’s are constrained to operate on a finite set of N input values sampled at a
sample rate of fs , to produce an N -point transform whose discrete outputs are
associated with the individual analytical frequencies,
k
meaning Xd ( N ), k = 0, 1, . . . , N − 1.
The DFT produces correct results only when the input data sequence contains
frequencies that match the analyzed frequencies. i.e.
k · fs k
u= = , k = 0, 1, 2 . . . , N − 1
N N

If the input has an intermediate frequency (between our analytical frequencies),


then it will show up to some degree in all of the N output analysis frequencies
of our DFT.

Example
Assume we’re taking a N = 64 point DFT of a sine-wave with exactly three
cycles contained in our N = 64 samples. (For simplicity let us choose fs = 64).

>> t = 0:1/64:1-1/64;
>> x = sin(2*pi*3*t);
>> Xu=fft(x);
>> absXu=abs(Xu);
>> relvabsXu=absXu(1:32);
>> stem (relvabsXu, ’DisplayName’, ’relvabsXu’, ’YDataSource’, ’relvabsXu’);
figure(gcf)

Figure 4: x = sin(2*pi*3*t)

19
Figure 5: DFT of x = sin(2*pi*3*t)

Not surprisingly the DFT shows us the right content of frequencies, meaning
Xk = 0 for all k other then k = 3 the forth sample.
The reason it worked is because 3Hz is one of the frequencies analyzed by the
DFT. Now lets take a sine-wave with exactly three and a half cycles contained
in our N = 64 samples.

>> t = 0:1/64:1-1/64;
>> x = sin(2*pi*3.5*t);
>> Xu=fft(x);
>> absXu=abs(Xu);
>> relvabsXu=absXu(1:32);
>> stem (relvabsXu, ’DisplayName’, ’relvabsXu’, ’YDataSource’, ’relvabsXu’);
figure(gcf)

Figure 6: x = sin(2*pi*3.5*t)

20
Figure 7: DFT of x = sin(2*pi*3.5*t)

This is leakage!. It causes any input signal whose frequency is not exactly at a
DFT analyzed frequency to leak into all of the other DFT outputs.
Even tough the input signal is a pure sine-wave, containing one fundamental
frequency, it is not reflected in the DFT. Moreover, leakage is an unavoidable
fact of life when we perform the DFT on real-world finite-length time sequences.
Although there’s no way to eliminate leakage completely, an important
technique known as windowing is the most common remedy to reduce its
unpleasant effects. Let’s look at another example to try and make the matter
easier.

Example 2
What one must understand is that sampling an analog signal over a finite period
of time b (which is always the case) equals to multiplying the signal x(t) with
rectangular window function defined as:

1 if 0 ≤ t ≤ b
p(t) =
0 otherwise

and retrieving N samples from that interval.

Figure 8: Sampling

21
N
One can easily see that sampling N times during b means fs = b .
Once again, the signal being sampled is not x(t),
but actually f (t) = x(t) · p(t) (Figure 8).
The sampled signal is
 PN −1
fd (t) = n=0 x(n)δ(t − n) if t ∈ [0, b]
0 otherwise
And its Fourier transform is
N
X −1
fbd (u) = x(n)e−2πinu
n=0

In the frequency domain this will equal to convoluting X(u) and P (u). Let us
calculate the Fourier transform of the window function p(t).
Z ∞ Z b
1
P (u) = p(t)e−2πiut dt = e−2πiut dt = (1 − e−2πiub ) =
−∞ 0 2πiu
−1 eπiub πiub
= (e − e−πiub ) = b · e−πiub sinc(πub)
2πiu e2πiub
This function equals to b when u = 0 and to zero at u = kb , k = ±1, ±2 . . ..

Figure 9: The sinc function

The bigger b is, the narrower the main and side lobs are. Hypothetically
speaking if b → ∞ then sinc(x) → δ(x).
k·fs
The frequencies analyzed by the DFT are u = N = kb , k = 0, 1, . . . , N − 1.
The DFT of fd (t) is
k k k k k
Fk = fbd ( ) = X( ) ∗ P ( ) = X( ) ∗ P ( ), k = 0, 1, 2, . . . , N − 1
N N N b b
or we can rewrite
X k
Fk = P (i) · X( − i) (4)
b
i=Z
Now we will consider 2 cases:

22
1. x(t) contains information only on frequencies u = kb , k = 0, 1, . . . , N − 1.
In that case the convolution will yield results that differ from zero only
when i = 0, and
k
Fk = b · X( ), k = 0, 1, . . . , N − 1
b
In that case there is no leakage.
2. x(t) contains information not only on frequencies u = kb ,
k = 0, 1, . . . , N −1, and leakage occurs. The results are best demonstrated
in figure 10.
Conclusion: We can think of the DFT input signal as the product of an input
signal existing for all time, and the rectangular window function whose
magnitude is 1 over the sample interval. Anytime we take the DFT of a finite
extent input sequence we are, by default, multiplying that sequence by a window
of all ones and effectively multiplying the input values outside that window by
zeros. As it turns out, the continuous Fourier transform of the rectangular
window function is the sinc function whose side lobes causing the leakage effect.
To minimize the spectral leakage caused by those side-lobes, we will have to
find a way to reduce the side-lobe amplitudes. That can be achieved by using
window functions other than the rectangular window.

Figure 10: Leakage

23
7.2 Window functions
By now we are familiar with the rectangular window function. That would be
enough to derive some important characteristics of window functions in general.
1. As the length b of the window increases, the width of the main lobe de-
creases.
2. The peak side-lobe amplitude of the window is determined by the shape
of the window, and it is essentially independent of the window length.
3. If the window shape is changed to decrease the side-lobe amplitude, the
width of the main lobe will generally increase.
There are an infinite number of window functions to choose from, here we will
introduce five well known window functions:

1. Rectangular window
2. Triangular window
3. Hanning window

4. Hamming window
5. Blackman window
Before we see exactly how well these windows minimize DFT leakage, let’s define
them mathematically.

• Rectangular window

Rn = 1, n = 0, 1, 2 . . . , N − 1

• Triangular window
(
n
N/2 for n = 0, 1, . . . , N2
Tn = n
2− N/2 for n = N2 + 1, . . . , N − 1

• Hanning window
2πn
Hann = 0.5 − 0.5cos( ), n = 0, 1, 2 . . . , N − 1
N −1

• Hamming window
2πn
Hamn = 0.54 − 0.46cos( ), n = 0, 1, 2 . . . , N − 1
N −1

• Blackman window
2πn 4πn
Bn = 0.42 − 0.5cos( ) + 0.08cos( ), n = 0, 1, 2 . . . , N − 1
N −1 N −1

24
Figure 11: Windows in time-domain

Figure 12: Windows in spectral-domain

From figure 12 it’s obvious that the side lobes of the other window functions
affect much less then the rectangular function. This in turn will diminish the
leakage effect.
It’s not that clear that there’s a great deal of difference among many of these
window functions. What we find is that window selection is a trade-off between
main lobe widening, first side lobe levels, and how fast the side lobes decrease
with increased frequency. The use of any particular window depends on the
application.
So before moving on let us return to the first example in section 7.1 and see
how using the Hanning window function will reduce the leakage of the DFT of
sin(2π3.5t). results are shown in figure 13.

25
>> n = 0:1/64:1-1/64;
>> x = sin(2*pi*3.5*n);
>> Xu=fft(x);
>> absXu=abs(Xu);
>> relvabsXu=absXu(1:32);
>> hn=0.5-0.5*cos(2*pi*n./(1-1/64));
>> newxn=x.*hn;
>> Xnew=fft(newxn);
>> absXnew=abs(Xnew);;
>> relvalXnew=absXnew(1:32);
>> plot(n(1:32),relvabsXu,n(1:32),relvalXnew);

Figure 13: Leakage reduced

26
7.3 Zero padding and DFT resolution
As mentioned at the beginning of section 7, the DFT can be regarded as a
frequency-domain sampled approximation of the Fourier transform. Hence, the
greater the amount of samples the better the approximation. But from what
we’ve learned so far we know that the amount of DFT samples equals the amount
of the time domain input sequence samples. (i.e. if x(t) was sampled N times,
its DFT will contain N samples).
If so, given only N samples of x(t) (meaning that {xn } got N values), How can
we get more then N samples in our DFT ?
One popular method used to improve DFT spectral estimation is known as zero
padding. This process involves the addition of zero-valued data samples to the
original DFT input sequence {xn } to increase the total number of input data
samples, yielding more samples in our DFT.
This can be easily understood when looking at the definition of DFT:
N −1
X −2πink
−1
Given {xn }N
n=0 the DFT is Xk = x[n] · e N , k = 0, 1 . . . , N − 1
n=0

Now adding M zeros to the end of the sequence (i.e. {xn } = (x1 , x2 , . . . , xn , 0, 0, 0, 0))
| {z }
M times
the DFT becomes
X−1
N +M
−2πink
Xk = x[n] · e N +M , k = 0, 1 . . . , N + M − 1
n=0

and the frequencies analyzed by the DFT are


k · fs
uanalyzed = , k = 0, 1, 2, . . . , N + M − 1
N +M

Example
Let us go back to our first example in section 7.1 where we calculated the 64
point DFT of the signal x(t) = sin(2π · 3 · t). The results are shown in figure 5.
The Fourier transform of x(t) can be calculated as follow :
Z 1
1 πi(3−u)
sin(2π·3·t)·e−2πiut dt = sinc(π(3−u))−e−πi(3+u) sinc(π(3+u))

e
0 2i

Looking at the result (figure 14) one can hardly believe the DFT is an approxi-
mation of the Fourier transform. Now lets add zeros to the end of the 64 samples
{xn } and then calculate the DFT. We will do this using MATLAB.
First we will add 32 zero-valued data samples, then 64 (figures 15 and 16).

27
Figure 14: Fourier transform of x = sin(2*pi*3*t)

Figure 15: DFT of x = sin(2*pi*3*t) with 32 zeros added

Obviously now, the DFT is a better approximation of the Fourier transform.


Do we gain anything by appending more zeros to the input sequence and taking
larger DFTs? (i.e. adding 128 zeros or 1000 zeros in our example)? Not really.
Oversampling it with a larger DFT won’t improve our understanding of the in-
put’s frequency content. The issue here is that adding zeros to an input sequence
will improve our DFT’s output resolution, but there’s a practical limit on how
much we gain by adding more zeros.Depending on the number of samples in
some arbitrary input sequence and the sample rate, we might, in practice, need
to append any number of zeros to get some desired DFT frequency resolution.
Remark: in practical situations, if we want to perform both zero padding and
windowing on a sequence of input data samples, we must be careful not to apply
the window to the entire input including the added zero-valued samples. The
window function must be applied only to the original nonzero time samples,
otherwise the padded zeros will zero out and “eliminate” part of the window
function, leading to wrong results.
Keep in mind, however, that zero padding does not improve our ability to
resolve, to distinguish between, two closely spaced signals in

28
Figure 16: DFT of x = sin(2*pi*3*t) with 64 zeros added

the frequency domain. To improve our true spectral resolution of two signals,
we need more non-zero time samples (This issue will be discussed later).

The zero padding will increase our DFT resolution, Is there a way to “improve”
the input sequence {xn } ? Meaning, given a sequence that includes N samples,
can we get more samples without re-sampling the original signal ?
The answer to that question is surprisingly yes. This is done by adding zero-
value data sample in between the existing samples. Therefore given the sequence
x[n] = (x1 , x2 , . . . , xn ) we will reconstruct a new sequence by introducing a
constant number of zero-value samples (lets say M samples) between every two
samples getting y[n] = (x1 , 0, . . . , 0, x2 , 0, . . . , 0, . . . , xn , 0, . . . , 0). hence,
| {z } | {z } | {z }
M times M times M times

n

x[ M ] when n = k · M, k = 0, 1, 2, . . .
y[n] =
0 otherwise

Now calculating the DFT of y[n]


n
N −1
MX N −1 N −1
z}|{
2πink 2πi kM l 2πilk
X X
Yk = y[n]e− MN = x[n]e − MN = x[n]e− N , k = 1, 2, . . . , N M −1
n=0 l=0 l=0

For k < N we get Yk = Xk (where Xk is the DFT of x[n]).


For k ≥ N we denote k = N · q + r, 0 ≤ r ≤ N − 1 and Yk = Xr .

l=k when k < N
Yk = Xl
l = kmodN when k ≥ N

29
Let us go back to the first example in section 7.1. In figure 4 we can see the 64
samples of the signal x(t) = sin(2π · 3t). Now lets make M = 4 and create y[n].

Figure 17: Samples of x[n] and y[n]

Now lets look at the DFT of x[n] and y[n]. From figures 18 and 19 it is plain
to see that the DFT of y[n] is a multiplication of Xk , M times.
In order to reconstruct an “improved” sequence x[n], one should zero-out all
the extra elements of Yk except for the first and last N2 samples.
So the algorithm is quit simple. given the sequence x[n] with N samples
• One should calculate its DFT - Xk .
• Build a new zero-value sequence (Yk ) which length is M · N .
N N
• Copy the the first 2 samples of Xk into the 2 first places of Yk .
N N
• Copy the the remaining 2 samples of Xk into the 2 last places of Yk .
• Calculating the inverse DFT of Yk will provide a new sequence y[n] which
contains all the original samples of x[n] and added non-zero samples in
between every two original sample.
Example 2
>> N=64;
>> M=4;
>> n= 0:N-1;
>> xn = sin(2*pi*3*n/N);
>> xk=fft(xn);
>> yk=zeros(1,M*N);
>> yk(1:32)=xk(1:32);
>> yk(end-31:end)=xk(33:64);
>> yn=ifft(yk);
>> plot(xn);
>> plot(abs(yk));
>> plot(yn);

30
Figure 18: DFT of x[n]

Figure 19: DFT of y[n]

7.4 Spectral resolution


By now we understand that as good as the DFT may be, there are things we
need to worry about when analyzing it. Another problem that arose
from example 1 in section 7.1 is that the DFT would be able to differentiate
between 3Hz and 4Hz , but we will have no informative knowledge from our
DFT if the input signal contains the frequencies 3.3Hz and 3.7Hz for example.
Our question is, what can we do to increase our DFT resolution ?
The answer is obvious - we need more samples. the more samples we got the
better the resolution. Just remember that retrieving N samples from a signal
x(t), means that (given the sampling rate was fs ) it was multiplied with a
rectangular window function of the length t = Nf−1
s
= b.
Lets denote  = u2 − u1 , where u1 and u2 are the two frequencies we want the
DFT to resolve (the needed resolution).
From the second example in section 7.1 we know the the width of the main lobe
of the sinc function (The Fourier transform of the rectangular function) is 2b .

31
In order for the DFT to be able to resolve u1 and u2 , we demand
2 N −1 2 2
≤ ⇒ b= ≥ ⇒ Nmin = fs · + 1
b fs  

Figure 20: DFT of the zeroed-out Yk

Figure 21: The “improved” x[n] (compare to figure 4)

32
8 The Z-Transform
The z-transform is a useful tool in the analysis of discrete-time signals and
systems (we should had that in many respects it is the discrete-time
counterpart of the Laplace transform for continuous-time signals and systems).
The z-transform may be used to solve constant coefficient difference equations,
solve filters given recursively, evaluate the response of a linear time-invariant
system to a given input, design linear filters and analyze signals and systems
where the Fourier transform doesn’t exist.

Definition 30 Given a discrete time signal {xn }n∈Z its Z-transform is denoted
as {Xz } ans is defined as :
X:Ω⊆C→C
X
X(z) = xn z −n
n∈Z

Where Ω is the Region Of Convergence (ROC) of the series and is defined as:
X
Ω = {z : |xn z −n | < ∞}
n∈Z

Usually the ROC will be annular ring-shaped and we will denote it as


Rm < |z| < RM .

8.1 Properties of ROC


1. The ROC does not contain poles of X(z).
2. If x[n] is a finite time sequence and X(z) convergence for some value of z,
then the ROC is the entire z-plane except possibly z = 0 or z = ∞.

3. If x[n] is a right-sided sequence (that is, x[n] = 0 for n < N ∈ Z and


X(z) converges for some value of z, then the ROC is of the form |z| > Rm
or ∞ > |z| > Rm where Rm equals the largest magnitude of any of the
poles of X(z). Thus, the ROC is the exterior of the circle |z| = Rm in the
z-plane with the possible exception of z = ∞.

4. If x[n] is a left-sided sequence (that is, x[n] = 0 for n > N ∈ Z and X(z)
converges for some value of z, then the ROC is of the form |z| < RM or
RM > |z| > 0 where RM is the smallest magnitude of any of the poles of
X(z). Thus, the ROC is the interior of the circle |z| = RM in the z-plane
with the possible exception of z = 0.

5. If x[n] is a two-sided sequence (that is, x[n] is an infinite-duration


sequence) and X(z) converges for some value of z, then the ROC is of the
form Rm < |z| < RM where Rm and RM are the magnitudes of the two
poles of X(z). Thus, the ROC is an annular ring in the z-plane between
the circles |z| = Rm and |z| = RM not containing any poles.

33
8.2 Properties of Z-transform
1. Linearity - If x[n] has a z-transform X(z) with a ROC Rm1 < |z| < RM 1 ,
and if y[n] has a z-transform Y (z) with a ROC Rm2 < |z| < RM 2 then,
Z
w[n] = αx[n] + βy[n] ↔ αX(z) + βY (z) = W (z)

And the ROC of w(z) will include the intersection of R1 and R2 , that is,
RM ≥ min{RM 1 , RM 2 } and Rm ≤ max{Rm1 , Rm2 }.
2. Time Shifting - Shifting a sequence (delaying or advancing) multiplies the
z-transform by a power of z. That is to say, if x[n] has a z-transform X(z)
then,
Z
x[n − n0 ] ↔ z −n0 X(z)
The ROC stays the same.
3. Multiplication by an Exponential - If x[n] has a z-transform X(z) with a
ROC Rm1 < |z| < RM 1 , then
Z z
x[n] · an ↔ X( )
a
And the new ROC is RM = |a| · RM 1 and Rm = |a| · Rm1 .
4. Time Reversal - If x[n] has a z-transform X(z) with a ROC Rm1 < |z| <
RM 1 then,
Z 1
x[−n] ↔ X( )
z
1 1
And the new ROC is RM = Rm1 and Rm = RM 1 .

5. Multiplication by n (or Differentiation in z) - If x[n] has a z-transform


X(z) with a ROC Rm1 < |z| < RM 1 then,

Z dX
nx[n] ↔ −z · (z)
dz
The ROC stays the same.
6. Accumulation (Integration) - If x[n] has a z-transform X(z) with a ROC
Rm1 < |z| < RM 1 then,
n
X Z z
x[k] ↔ · X(z)
−∞
z−1

And the ROC is Rm ≤ Rm1 as long as Rm > 1 and RM ≥ RM 1.


7. Convolution - If x[n] has a z-transform X(z) with a ROC Rm1 < |z| <
RM 1 , and if y[n] has a z-transform Y (z) with a ROC Rm2 < |z| < RM 2
then,
x[n] ∗ y[n] = X(z) · Y (z)
And the ROC is RM ≥ min{RM 1 , RM 2 } and Rm ≤ max{Rm1 , Rm2 }.

34
8. Multiplication - If x[n] has a z-transform X(z) with a ROC Rm1 < |z| <
RM 1 , and if y[n] has a z-transform Y (z) with a ROC Rm2 < |z| < RM 2
then, Z
1 z
x[n] · y[n] = X(ζ) · Y ( ) · ζ −1 dζ
2πi γ ζ
Where γ is a counterclockwise contour of integration enclosing the origin
inside the ROC, which is:
Rm ≤ Rm1 · Rm2 and RM ≥ RM 1 · RM 2 .

8.3 The inverse Z-transform


Inversion of the z-transform to find the sequence x[n] from its z-transform X(z)
is called the inverse z-transform, symbolically denoted as x[n] = Z−1 {X(z)}.
Theorem 31 Z
1
∀n ∈ Z, x[n] = X(z) · z n−1 dz
2πi γ

Where γ is a counterclockwise contour of integration enclosing the origin all


inside the ROC.
Proof
In order to prove theorem 31, we will first prove the following claim:
Claim 32 Z
1
z n dz = δ(n + 1)
2πi γ

Proof
We’ll choose γ to be a cycle of radius R contained inside the ROC, hence,
z = Reiθ for 0 ≤ θ ≤ 2π and dz = iReiθ dθ. Rewriting the integral we get
Z 2π Z 2π
1 1 n+1
Rn einθ iReiθ dθ = R i ei(n+1)θ dθ =
2πi 0 2πi 0
2π 
1 n+1 ei(n+1)θ 0 if n 6= −1
= R i =
2πi i(n + 1) 0 1 if n = −1
Now we will prove theorem 31.
X(z)
Z Z zX }| { Z
1 1 X 1
X(z)·z n−1 dz = x[k]z −k ·z n−1 dz = x[k] z −k+n−1 dz =
2πi γ 2πi γ 2πi γ
k∈Z k∈Z
1
R −k+n−1
According to claim 32 2πi γ z dz = 1 only when k = n, therefore
Z
X 1 X
x[k] z −k+n−1 dz = x[k]δ(n − k) = x[n]
2πi γ
k∈Z k∈Z

35
8.4 The transfer function
In section 5.2 we showed that the input-output relationship for LTI systems
is described in terms of a convolution operation with impulse response of the
system (theorem 24).
i.e y[n] = x[n] ∗ h[n]. Applying the convolution property of the z-transform, we
obtain Y (z) = X(z) · H(z), where Y (z), X(z), and H(z) are the z-transforms
of y[n], x[n], and h[n], respectively. From the last equation we get that
Y (z)
H(z) =
X(z)
Definition 33 The z-transform H(z) of h[n] is referred to as the transfer
function (or the system function) of the system.

Looking back at section 5.1 we will now try to classify systems using the transfer
function.

Theorem 34 A system/filter is BIBO stable if and only if


X
|h[n]| < ∞ (i.e h[n] ∈ l1 ).
n∈Z

Proof P
First we will show that if n∈Z |h[n]| < ∞ then the system is BIBO stable.
Suppose the input signal x[n] is bounded, (i.e. ∃A ∈ R : |x[n]| ≤ A).
By definition
X X X X
y[n] = x[n−k]h[k] ⇒ |y[n]| ≤ |x[n−k]|·|h[k]| ≤ A·|h[k]| = A |h[k]|
k∈Z k∈Z k∈Z k∈Z
P
Since we know that n∈Z |h[n]| < ∞ then we get that y[n] P is bounded.
Now let us show
P that if the system is BIBO stable then n∈Z |h[n]| < ∞.
Lets assume n∈Z |h[n]| = ∞ and we will show that the system is not BIBO
stable.
Consider the following bounded input
(
h[−n]
|h[−n]| if h[−n] 6= 0
x[n] =
0 otherwise

Again by definition we know that


X X X h[k]2
y[n] = x[n − k]h[k] ⇒ y[0] = x[−k] · h[k] = =∞
|h[n]|
k∈Z k∈Z k∈Z

Meaning the system is not BIBO stable.


How can we know fromP the transfer function if the system is BIBO stable ?
We know that H(z) = n∈Z h[n] · z −n substituting z = 1 we get
X X
H(1) = h[n] ⇒ |H(1)| ≤ |h[n]|
n∈Z n∈Z

Hence, if |H(1)| converges then the system is BIBO stable. In other words if the
ROC of H(z) contains the unit circle (Rm < 1, RM > 1) the system is stable.

36
Notice that every number on the unit circle can be written as z = e2πiu , and
for any stable system we get
X
H(e2πiu ) = h[n] · e−2πinu = h(u)
d
n∈Z

Therefore we note that for unstable systems the Fourier transform doesn’t exist.

Theorem 35 A system is causal if and only if ∀n < 0, h[n] = 0.

Proof
P
y[n] = k∈Z x[n−k]h[k] , for any k = −p < 0, p > 0 we get y[n] = x[n+p]h[−p]
if the system is causal, then y[n] can not depend on x[n + p] therefore h[−p] = 0,
on the other hand if h[−p] = 0, ∀p > 0 then the system is causal.
Looking at the transfer function we find that the system is causal if and only if
the ROC of H(z) is of the form |z| > Rm , That is, the ROC is the exterior of a
circle containing all of the poles of H(z) in the z-plane.

Theorem 36 A system will be both BIBO stable and causal if and only if all
of the poles of H(z) lie inside the unit circle of the z-plane.

8.5 Systems Described by Linear Constant-Coefficient


Difference Equations
Lets considered a discrete-time LTI system for which input x[n] and output y[n]
satisfy the general linear constant-coefficient difference equation of the form:
p
X q
X
y[n] + ai y[n − i] = bi x[n − i]
i=1 i=0

Applying the z-transform and using the time-shift property and the linearity
property of the z-transform, we obtain
p
X q
X
−i
Y (z) + ai · z Y (z) = bi · z −i X(z)
i=1 i=0

Thus, the transfer function will be of the form


Pq −i
Pq
Y (z) i=0 bi · z z −q i=0 bi · z
q−i
H(z) = = P p −i
= −p
· P p
X(z) 1 + i=1 ai · z z z + i=1 ai · z p−i
p

Now we can differentiate 2 cases:


1. p ≥ q
Pp
- The poles of H(z) are the poles of z p + i=1 ai · z p−i
Pq
- The zeros of H(z) are the zeros of i=0 bi · z q−i and z = 0 if p > q.
2. p < q
Pp
- The poles of H(z) are the poles of z p + i=1 ai · z p−i and z = 0.
Pq
- The zeros of H(z) are the zeros of i=0 bi · z q−i .

37
Example
Find the transfer function of the two following systems. Determine whether
they are BIBO stable and\or causal. When possible find the Fourier transform
of the transfer function.
1. y[n] = x[n] − x[n − 1]
2. y[n] − y[n − 1] = x[n]
Lets start with (1). Applying the z-transform on both sides immediately yields
1
Y (z) = X(z) + z −1 · X(z) ⇒ H(z) = 1 +
z
The only pole is z = 0 therefore the system is stable and causal. In this case we
can find its Fourier transform by substituting z = e2πiu
1 2i
H(e2πiu ) = h(u)
d =1+ = πiu sin(πu)
e2πiu e
Moving on to (2) we find that
z
Y (z) + z −1 · Y (z) = X(z) ⇒ H(z) =
z−1
The only pole is z = 1 and it is on the unit circle therefore the system is not
stable. The system is causal though, it can easily be seen from the original
equation where y[n] depends only on samples from present time and past. Since
the system is not stable Its Fourier transform doesn’t exists.

8.6 Methods for calculating the inverse transform

1. Fourier transform - When the system is stable we can easily find its Fourier
transform from the z-transform and use the already well know formula for
the inverse Fourier transform.
2. Inversion Formula - Using the formal expression for the inverse z-transform
in terms of an integration in the z-plane (section 8.3).
3. Use of Tables of z-Transform Pairs - We try to express X(z) as

X(z) = X1 (z) + X2 (z) + · · · + Xn (z)

Where each of the terms Xi (z) is a function with known a inverse trans-
form.
4. Using the Residue formula - From the complex number theory we know
that if X(z) has a singular point at z0 then
Z
1
X(z)dz = Res(X(z))z0
2πi γ

And if X(z) has k singular points, then


Z K
1 X
X(z)dz = Res(X(z))zi
2πi γ j=1

38
Definition 37 If X : Ω\{z0 } → D is an analytic function, and if ∃m ∈ N
so that g(z) = (z − z0 )m · X(z), and g(z) is an analytic function over Ω,
then
1
Res(X(z))z0 = g (m−1) (z0 )
(m − 1)!

So, in order to calculate


Z
1
x[n] = X(z)z n−1 dz
2πi γ

We will have to find the residue at the singular points of X(z)z n−1 .

39
9 Filter Design
9.1 Systems Interconnection
Sometimes when looking at a system we find that it can be resolve into smaller,
easier to deal with systems. We will consider three cases
1. For m LTI systems (with h1 [n], · · · hm [n] respectively) in cascade, the over
all impulse response (IR) is given by (see figure 22-a)

H(z) = H1 (z) · H2 (z) · · · Hm (z)

2. For m LTI systems (with h1 [n], · · · hm [n] respectively), connected in par-


allel the over all impulse response (IR) is given by (see figure 22-b)
m
X
H(z) = Hi
i=1

3. The more common case will be mixed systems with smaller systems
connected in series and parallel. In that case we need to find small parts
where the systems are connected to each other in one consistent way, solve
the smaller parts and then combine everything to get H(z).

Figure 22

9.2 Filter Design


The design process begins with the filter specifications, which may include
constraints on the magnitude and/or phase of the frequency response and
specification of the type of filter (i.e. FIR or IIR). Once the specifications have
been defined, the next step is to find a set of filter coefficients that produce an
acceptable filter. Analog filtering is performed on continuous time signals and
will not be discussed here. Digital filtering is performed on discrete time signals
and is usually implemented on a computer. Digital filters (of LTI systems) are
usually specified by their transfer function which is in most cases rational and
causal
b0 + b1 z −1 + · · · + bq z −q
H(z) =
a0 + a1 z −1 + · · · + ap z −p

40
Digital filters for which p ≥ 1 are called Infinite Impulse Response filters (IIR).
Digital filters for which p = 0 are called Finite Impulse Response filters (FIR).
FIR filters are characteristic of the discrete time domain (they are rarely used
as analog filters).

9.2.1 Filter Specifications - Magnitude Response


Before a digital filter can be implemented we need to specify its performance
requirements, such us what frequencies should be attenuated or gained. There
are four basic filter types

1. Low Pass Filter - designed to pass low frequencies from zero to a certain
cut-off frequency u0 and block the higher frequencies.
2. High Pass Filter - designed to pass high frequencies from a certain cut-off
frequency u0 and block the lower frequencies.

3. Band pass filter - designed to pass a certain frequency range [u0 , u1 ] (which
do not include zero) and block the other frequencies.
4. Band Stop Filter - designed to stop a certain frequency range [u0 , u1 ]
(which do not include zero) and pass the other frequencies.

Figure 23: Ideal filters

The filters shown in figure 23 are ideal. Practical filters are not shaped in
straight lines but we assume the filters are real, hence their magnitude response
is symmetric and their phase response is asymmetric. A graphical description
of a real-life Low Pass Filter is shown in figure 24.

41
Figure 24: “Real life” LPF
Where up is the cut-off frequency, us is the stop-band frequency, δp is the
passband deviation and δs is the stop-band deviation. The exact behavior of the
frequency response of the filter in the transition band is usually of no importance.
So the new specification would be
0
1 − δp ≤ |H(u)| ≤ 1 + δp , 0 ≤ u ≤ up

0 ≤ |H(u)| ≤ δs , us ≤ u ≤ 0.5
The passband and stop-band deviations are often given in decibels (dB) as
follow:
0
αp = max{−20log10 (1 − δp ), 20log10 (1 + δp )} αs = −20log10 (δs )

The same goes for a High Pass Filter where

0 ≤ |H(u)| ≤ δs , 0 ≤ u ≤ us
0
1 − δp ≤ |H(u)| ≤ 1 + δp , up ≤ u ≤ 0.5
A Band Pass Filter
0 ≤ |H(u)| ≤ δs1 , 0 ≤ u ≤ us1
0
1 − δp ≤ |H(u)| ≤ 1 + δp , up1 ≤ u ≤ up2
0 ≤ |H(u)| ≤ δs2 , us2 ≤ u ≤ 0.5
And a Band-Stop Filter
0
1 − δp1 ≤ |H(u)| ≤ 1 + δp1 , 0 ≤ u ≤ up1

0 ≤ |H(u)| ≤ δs , us1 ≤ u ≤ us2


0
1 − δp2 ≤ |H(u)| ≤ 1 + δp2 , up2 ≤ u ≤ 0.5

42
9.2.2 Filter Specifications - Phase Response
In most filtering applications, the magnitude response is our primary concern.
However, the phase response may also be important and can not be made
arbitrary. Lets look at a BIBO stable filter h[n]. Its Fourier transform is given
in X
H(u) = h[n] · e−2πinu = A(u)e−iφ(u)
n∈Z

Where A(u) = ±|H(u)| and φ(u) is a continuous function.


Suppose the input signal x[n]. The output of the system is given by

Y (u) = H(u) · X(u) = A(u)e−iφ(u) · X(u)

From the last expression and the Fourier transform properties we can see that
multiplying X(u) by e−iφ(u) equals to time shift of x[n]. i.e. The phase of the
filter will shift in the time domain the frequencies of the input signal. The shift
is by φ(u). Let us understand that mathematically.
Suppose the input signal contains only frequencies around u = u0

X(u) = 0, if u ∈
/ [u0 − , u0 + ]

Now let us calculate the Taylor expansion of φ(u) around u0

dφ(u0 )
φ(u) = φ(u0 ) + (u − u0 ) + R(u−u0 )
du
dφ(u0 )
Denoting τ = − du (τ is also known as the phase delay of the filter) we get

φ(u) = φ(u0 ) − τ (u − u0 ) + R(u−u0 )

Since Y (u) = H(u) · X(u) then,


Z 0.5 Z u0 + Z u0 +
y[n] = H(u)X(u)e2πinu du = H(u)X(u)e2πinu du = A(u)e−iφ(u) X(u)e2πinu du
−0.5 u0 − u0 −

Now using the Taylor expansion for φ we get


Z u0 + Z u0 +
y[n] = A(u)e−i(φ(u0 )−τ (u−u0 )) X(u)e2πinu du = e−iφ(u0 ) A(u)ei(τ (u−u0 )) X(u)e2πinu du =
u0 − u0 −
Z u0 +
e−iφ(u0 ) X(u)ei(τ (u−u0 )) A(u)e2πinu du
u0 −

Therefore for the frequencies of the input not to scatter we ask τ = 0


(for constant phase filter) or τ = constant (for linear phase).
Conclusion: When designing a filter we must constrain the phase to be
constant or linear (in most cases).

43
9.3 FIR filter design

Definition 38 h[n] is an FIR filter if

∃N1 , N2 ∈ N : if n ∈
/ [N1 , N2 ] then h[n] = 0

From the definition we find that the z-transform of an FIR filter will be
N2
X
H(z) = h[n]z −n
n=N1

There is only one pole and it is located at z = 0. thus, FIR filters are always
stable.
What about causality ?
For the filter to be causal we demand N1 ≥ 0.
Lets design a FIR filter with a constant phase, so that φ(u) = 0.
So from what we know so far we can write
N2
X
H(z) = h[n]z −n
n=N1

Since the filter is stable we write


N2
X N2
X N2
X
H(u) = h[n]e−2πinu = h[n]cos(2πnu) − i h[n]sin(2πnu)
n=N1 n=N1 n=N1

 PN2
h[n]sin(2πnu)

n=N1
arg(H(u)) = arctg PN2
n=N1 h[n]cos(2πnu)
PN2
Thus, for φ(u) = arg(H(u)) = 0 we ask N1 h[n]sin(2πnu) = 0.
The latter can only happen if N2 = −N1 = N and h[n] will be symmetric, i.e.
h[n] = h[−n], ∀n.
Conclusion: A FIR filter with φ(u) = 0 can not be causal.
How can we make it causal ?
Time shifting. Let us shift h[n] so it starts at n = 0 instead of n = N1 . But we
must be ware of the effect such a move will have on the phase. the z-transform of
the shifted filter is z −N H(z), and its Fourier transform is H(u)e−2πiuN meaning
φ(u) = −2πN u. The phase is now linear and not constant any more.
The question we now ask is what are all the options and constrains for\on an
FIR filter to be
1. Causal
2. Have a linear phase response

Asking for a linear phase response means du =constant or φ(u) = 2πuα + β.
Applying the causality demand we find
N
X −1 N
X −1 N
X −1
H(u) = h[n]e−2πinu = h[n]cos(2πnu) − i h[n]sin(2πnu)
n=0 n=0 n=0

44
1. Lets demand β = 0.
PN −1
h[n]sin(2πnu)
φ(u) = 2πuα ⇒ tg(2πuα) = P0N −1 ⇔
0 h[n]cos(2πnu)
N
X −1 N
X −1
h[n]sin(2πnu)cos(2πuα) = h[n]cos(2πnu)sin(2πuα) ⇔
0 0
N
X −1
h[n](sin(2πnu)cos(2πuα) − cos(2πnu)sin(2πuα)) = 0
0
N
X −1
h[n](sin(2πnu − 2πuα)) = 0
0

And for that to happen we ask


• h[n] = h[N − 1 − n], ∀n
N −1
• α= 2

2. Lets demand β 6= 0.
Going through the same process we find that causality and linear phase
can be obtain only if β = ± π2 , h[n] is asymmetric i.e.
h[n] = −h[N − 1 − n], ∀n and α = N 2−1 .
Summarizing everything to far we find that designing a real, causal and stable
FIR filter with linear phase is possible in 4 types

1. Impulse response is symmetrical around N 2−1 and N is odd (meaning the


order of the filter is even and equals N − 1).
N −1
2. Impulse response is symmetrical around 2 and N is even.
N −1
3. Impulse response is asymmetrical around 2 and N is odd.
N −1
4. Impulse response is asymmetrical around 2 and N is even.
The order of a filter (M ) is always equal to length-1, i.e. M = N − 1. We will
now derive expressions for the frequency response for each one of the four types
of filters.

9.3.1 Type-I filters


Type I filter have even order (odd length), and initial phase φ(0) = 0. Their
impulse response satisfies the symmetry condition h[n] = h[N − n].
Their frequency response is drives as follow (note: ω = 2πu and 2M = N − 1)
2M
X 2M
X
H(ω) = h[n]e−iωn = e−iωM h[n]eiω(M −n) =
n=0 n=0

M
X −1 2M
X
= e−iωM (h[M ] + h[n]eiω(M −n) + h[n]eiω(M −n) ) =
n=0 n=M +1

45
M
X −1 M
X −1
−iωM iω(M −n)
=e (h[M ] + h[n]e + h[N − n]e−iω(M −n) ) =
n=0 n=0
M
X −1 M
X
= e−iωM h[M ] + 2 h[n]cos(ω(M − n)) = e−iωM
 
a[n]cos(ω(M − n))
n=0 n=0

where 
h[M ], n = M
a[n] =
2h[n], 0 ≤ n ≤ M − 1
Please note that M = N 2−1 = α.
The magnitude of the frequency response can be written in the following form
M
X
A(ω) = g[n]cos(ωn)
n=0

where 
h[M ] , n=0
g[n] =
2h[M − n], 1 ≤ n ≤ M

9.3.2 Type-II filters


Type II filter have odd order (even length), and initial phase φ(0) = 0. Their
impulse response satisfies the symmetry condition h[n] = h[N − n].
Their frequency response is drives as follow (note: 2M + 1 = N − 1)
2M
X +1 2M
X +1
H(ω) = h[n]e−iωn = e−iω(M +0.5) h[n]eiω(M +0.5−n) =
n=0 n=0

M
X 2M
X +1
= e−iω(M +0.5) ( h[n]eiω(M +0.5−n) + h[n]eiω(M +0.5−n) ) =
n=0 n=M +1

M
X M
X
= e−iω(M +0.5) ( h[n]eiω(M +0.5−n) + h[N − n]e−iω(M +0.5−n) ) =
n=0 n=0
M
X
= e−iω(M +0.5) (2 h[n]cos(ω(M + 0.5 − n))) =
n=0

Here M + 0.5 = N 2−1 = α.


The magnitude of the frequency response can be written in the following form
M
X
A(ω) = cos(0.5ω) g[n]cos(ωn)
n=0

where

 0.5g[M ], n=0
2h[n] = 0.5(g[M + 1 − n] + g[M − n]), 1 ≤ n ≤ M − 1
0.5g[1] + g[0], n=M

46
Or
g[M ] = 4h[0],
g[M − n] = 4h[n] − g[M − n + 1], 1 ≤ n ≤ M − 1
g[0] = 2h[M ] − 0.5g[1],
It can be seen that A(ω) = 0 for u = 0.5. Therefore type II filters are not
suitable for HPF and stop-band filters (in contrast to type I which are suitable
for filters of all kind).

9.3.3 Type-III filters


Type II filter have even order (odd length), and initial phase φ(0) = π2 . Their
impulse response satisfies the asymmetry condition h[n] = −h[N − n].
Their frequency response is drives as follow (note: 2M = N − 1)
M
X −1 2M
X
H(ω) = e−iωM ( h[n]eiω(M −n) + h[n]eiω(M −n) ) =
n=0 n=M +1

M
X −1 M
X −1
= e−iωM ( h[n]eiω(M −n) + h[N − n]e−iω(M −n) ) =
n=0 n=0
M
X
= ei(0.5π−ωM ) 2

h[n]sin(ω(M − n))
n=0
N −1
Again M = 2= α.
The magnitude of the frequency response can be written in the following form
M
X −1
A(ω) = sin(ω) g[n]cos(ωn)
n=0

where


 0.5g[M − 1], n=0
0.5g[M − 2], n=1

2h[n] =

 0.5(g[M − 1 − n] + g[M + 1 − n]), 2 ≤n≤M −2
g[0] − 0.5g[2], n=M −1

Or
g[M − 1] = 4h[0],
g[M − 2] = 4h[1],
g[M − n] = 4h[n − 1] + g[M − n + 2], 3 ≤ n ≤ M − 1
g[0] = 2h[M − 1] + 0.5g[2],
It can be seen that A(ω) = 0 for u = 0 and u = 0.5. Therefore type III filters
are only suitable for band pass filters, but since they do not have an exact linear
phase (i.e. φ(0) = 0) they are not widely used for this application.

47
9.3.4 Type-IV filters
π
Type II filter have odd order (even length), and initial phase φ(0) = 2. Their
impulse response satisfies the asymmetry condition h[n] = h[N − n].
Their frequency response is drives as follow (note: 2M + 1 = N − 1)
M
X M
X
H(ω) = e−iω(M +0.5) ( h[n]eiω(M +0.5−n) + h[N − n]e−iω(M +0.5−n) ) =
n=0 n=0

M
X
= ei(0.5π−ω(M +0.5)) (2 h[n]sin(ω(M + 0.5 − n)))
n=0

Here M + 0.5 = N 2−1 = α.


The magnitude of the frequency response can be written in the following form
M
X
A(ω) = sin(0.5ω) g[n]cos(ωn)
n=0

where

 0.5g[M ], n=0
2h[n] = 0.5(g[M − n] − g[M + 1 − n]), 1 ≤ n ≤ M − 1
g[0] − 0.5g[1], n=M

Or
g[M ] = 4h[0],
g[M − n] = 4h[n] + g[M − n + 1], 1 ≤ n ≤ M − 1
g[0] = 2h[M ] + 0.5g[1],
It can be seen that A(ω) = 0 for u = 0. Therefore type IVI filters are not
suitable for LPF and stop-band filters.

Summary As we have seen the frequency response of linear phase FIR filters
(for all four types) are of the form

H(ω) = A(ω)ei(φ(0)−ωα)

The magnitude response is


J
X
A(ω) = F (ω) · G(ω), G(ω) = g[j]cos(ωj)
j=0

and 

 1 T ype I
cos(0.5ω) T ype II

F (ω) =

 sin(ω) T ype III
sin(0.5ω) T ype IV

48
9.3.5 Zero Locations of FIR Filter
Let H(z) be the transfer function of a linear phase FIR filter with real coeffi-
cients.
Claim 39
H(z −1 ) = ±z N −1 · H(z)
Proof
N
X −1 N
X −1 N
X −1
H(z −1 ) = h[n]z n = z N −1 · h[n]z −(N −1−n) = z N −1 · h[N −1−n]z −n =
n=0 n=0 n=0

N
X −1
z N −1 · ±h[n]z −n = ±z N −1 · H(z)
n=0

Where h[n] = ±h[N − 1 − n] depends if it is symmetric or asymmetric.


From the last claim we now obtain that if z = z0 is a zero of the filter then
z = z0−1 is a zero as well. Therefore the zeros of the filter must obey the following
restrictions
1. If z = ±1 is a real zero on the unit circle,then it is singular.
2. If z = ±r, r 6= 1 is a real zero not on the unit circle,then z = ± 1r is a zero
as well.
3. If z = e2πiu is a complex zero on the unit circle, then z = e−2πiu is a zero
as well.
4. If z = r · e2πiu , r =6 1 is a complex zero not on the unit circle, then
z = r · e−2πiu , z = 1r · e2πiu and z = 1r · e−2πiu are zeros as well.
Changing the zero of a filter with on of its “equivalent” zeros will leave the
magnitude response unchanged but is will change the phase response.

10 Methods of designing a FIR filter


10.1 Impulse Response Truncation - IRT
Ideal filters as seen in Figure 23 have an infinite impulse response. Truncating
the impulse response of such an ideal filter on both the left and the right yields a
finite impulse response whose frequency response approximates that of the ideal
filter. Moreover by shifting the truncated IR to the right we make it causal.
This is the basic idea behind this method design.
So now let us write down the steps we need to follow:
1. Write the desired magnitude response Ad (ω) of your desired filter.
2. Choose your filter initial phase (φ(0) = 0, or φ(0) = π2 , φ(0) = 0
corresponds to a symmetric filter and φ(0) = π2 to an asymmetric).
3. Choose the length (N ) of your filter.
N −1
4. We can now write Hd (ω) = Ad (ω)ei(φ(0)−ωα) , where α = 2 .

49
5. Compute the IR of the desired filter using the inverse Fourier transform
Z π
1
hd [n] = Ad (ω)ei(φ(0)−ωα) eiωn dω
2π −π

6. Truncate hd [n] by taking



hd [n] 0≤n≤N −1
h[n] =
0 Otherwise

Example
Design a LPF such that

0 ≤ ω ≤ π4

1
Ad (ω) = π
0 4 ≤ω ≤π

Let us follow the given instructions. We choose φ(0) = 0 and N = 100. Hence,
 −i(ω 99 )
e 2 0 ≤ ω ≤ π4
Hd (ω) =
0 π4 ≤ ω ≤ π

Now computing hd [n] we get


Z π
1 4 99
hd [n] = e−i(ω 2 ) eiωn dω =
2π −π
4

π
hd [n] = 0.25sinc( (n − 49.5))
4
We finally get

0.25sinc( π4 (n − 49.5)) 0 ≤ n ≤ 99,



h[n] =
0 Otherwise

>> N=100;
>> n=0:N-1;
>> u=0:1/N:1-1/N;
>> h=0.25*(sin((pi/4).*(n-49.5)))./((pi/4).*(n-49.5));
>> H=fft(h);
>> plot(u,abs(H));
In figure 25 and figure 26 we can see the desired filter and the actual filter
respectively.

50
Figure 25: Desired

Figure 26: Actual

The question we now ask is what is the minimal N we should choose in order
for h[n] to be accurate within our demands i.e. (Figure 27)
0
1 − δp ≤ |H(u)| ≤ 1 + δp , 0 ≤ u ≤ up

0 ≤ |H(u)| ≤ δs , us ≤ u ≤ 0.5
and for the transition band to be minimal ?
For the more general case we find that hd [n] is alway of the form

hd [n] = an · sin(kn + b) + dn · sin(tn + c)

Approximating a piece wise continuous function with a finite number of sine


function will always yield the Gibbs phenomenon, hence the tolerance
parameters δp and δs will never be smaller then ≈ 0.09 no matter how large N .
(of course that the bigger N is the smaller the phenomenon is, but till a certain

51
point).
Increasing N will affect the transition band though, the bigger N is the narrower
the band will get. The upper limit of the band’s width would be 4π N .

Figure 27: The effect of N


One way to overcome this problem is windowing. Truncating equals to using
a rectangular window. Instead lets use another window (some of which are
mentioned in section 7.2).
The improved method will now consist of:
1. Write the desired magnitude response Ad (ω) of your desired filter. This
time choose the cut off frequency to be the average of your desired stop-
band and pass-band frequencies (i.e 0.5(up + us )).

2. Obtain hd [n] as in the IRT method.


3. compute h[n] as follow

w[n]hd [n] 0 ≤ n ≤ N − 1,
h[n] =
0 Otherwise

Please note: windows are always symmetric and satisfy w[n] = w[N − n].

10.2 DFT method


1. Write the desired magnitude response Ad (ω) of your desired filter. It
should be symmetric around ω = π.
2. Steps 2-4 are the same as in the IRT method.
k
3. Now that we have Hd (ω) we sample it at ω = N, k = 0, 1, . . . N − 1.

52
4. Compute h[n] using the inverse DFT formula
N −1
X k iωn k
h[n] = Hd ( )e N
N
k=0

10.3 Least-Squares Design


1. According to your desired filter choose one of the 4 FIR filter types (section
9.3).
2. Choose the length N of the filter.
3. To each frequency ω assign a weight v(ω) (the weight is a non-negative
number reflection the relative importance of the error between Ad (ω) and
A(ω)). A common choice for v(ω) is
 −1
 δP,j ω in the j pass band,

−1
v(ω) = δs,j ω in the j stop band,


0 ω in any of the transition bands

4. Define error function as

S(ω) = v(ω)[Ad (ω) − A(ω))]

and the integral of the weighted square error as


Z π
E= S(ω)2 dω
−π
PK
Where A(ω) = F (ω)G(ω), G(ω) = k=0 g[k]cos(ωk). K and F (ω)
depend on the filter type chosen in (1). now
Z π K
X
E= v(ω)2 [Ad (ω) − F (ω) g[k]cos(ωk)]2 dω
−π k=0

For symmetry reasons we integrate only over the positive frequencies


Z π K
X
E= v(ω)2 [Ad (ω) − F (ω) g[k]cos(ωk)]2 dω
0 k=0

5. To find optimal coefficient g[k], differentiate E with respect to g[k]


Z π
∂E ∂S(ω)
= 2S(ω) dω
∂g[m] −π ∂g[m]
where
∂S(ω)
dω = −v(ω)F (ω)cos(ωm)
∂g[m]
Getting
Z π K
X
−2 v(ω)2 F (ω)cos(ωm)[Ad (ω)−F (ω) g[k]cos(ωk)]dω = 0, 0 ≤ m ≤ K
0 k=0

53
We now get a set of K + 1 equations with the same amount of unknowns.
K
X
cm,k g[k] = dm , 0 ≤ m ≤ K
k=0

where Z π
cm,k = v(ω)2 F (ω)2 cos(ωm)cos(ωk)dω
0
Z π
dm = v(ω)2 F (ω)Ad (ω)cos(ωm)dω
0

6. Sometimes cm,k and dm are approximated by sums. Choose I to be a


number proportional to N − 1 (say I = 15(N − 1)), then
I−1
πX
cm,k = v(ωi )2 F (ωi )2 cos(ωi m)cos(ωi k)
I 0

I−1
πX
dm = v(ωi )2 F (ωi )Ad (ωi )cos(ωi m)
I 0

7. To get g[k] solve


K
X
cm,k g[k] = dm , 0 ≤ m ≤ K
k=0

8. Compute h[n] using g[k] and the relations given according to the type
chosen.

10.4 Equiripple Design


This is a more advance method. Here we minimize sup|E(ω)|, 0 ≤ ω ≤ 2π,
where
E(ω) = v(ω)[Ad (ω) − A(ω))]
For more information look at the Matlab function ’firpm’
(http://matlab.izmiran.ru/help/toolbox/signal/firpm.html) and at any
of the books recommended for this course.

54
11 IIR Filters
Infinite impulse response (IIR) digital filters are fundamentally different from
FIR filters because practical IIR filters always require feedback. Where FIR
filter output samples depend only on past input samples, each IIR filter output
sample depends on previous input samples and previous filter output samples.
Relative to FIR filters, IIR filters have more complicated structures , are harder
to design and analyze, and do not have linear phase responses. Why then,
would anyone use an IIR filter? Because they are very efficient. IIR filters
require far fewer multiplications per filter output sample to achieve a given
frequency magnitude response.
As already mentioned IIR filters get their name from the fact that some of
the filter’s previous output samples are used to calculate the current output
sample. Given a finite duration of nonzero input values, the effect is that an
IIR filter could have a infinite duration of nonzero output samples. So, if the
IIR filter’s input suddenly becomes a sequence of all zeros, the filter’s output
could conceivably remain nonzero forever. Standard IIR filter design techniques
fall into three basic classes: the impulse invariance, bilinear transform, and
optimization methods.
Before going into how to design an IIR filter let us know two important families
of IIR filters
• Butterworth Filters

• Chebyshev Filters
But before going there there are just a few things we need to know about analog
filters.

11.1 Analog Filters


Analog filters are specified quite similar to digitals. The main difference is
the the frequencies are specified in the angular frequency (ω) domain, i.e in
Radian per second instead of the time-frequency domain (while we used to
work between 0 − 2π, now there is no limit). Moreover for analog filters, the
pass-band magnitude response is usually required to be in the range [1 − δp , 1].
This is mainly a matter of convenience but we will follow it (see section 9.2.1).
Analog filters are usually specified by their s−domain transfer function (and if
speaking of casual and rational filters we shall have)

b0 sq + b1 sq−1 + · · · + bq
H(s) =
sp + a1 sp−1 + · · · + ap

where mostly q ≤ p.
For the filter to be stable, we ask that all the poles will be on the left side of
the complex plane. In order To find the Fourier transform of a stable filter, one
should substitute s by iω.
To the parameters defined in section 9.2.1 we will a few more:

1. The -3dB frequency, defined as the frequency at which the magnitude


response of the filter is √12 of its nominal value at the pass band.

55
2. The asymptotic attenuation at high frequencies. This parameter is
determined by
H(ω) ≈ b0 (iω)q−p
which holds for ω larger then approx 5 times the largest absolute value of
all poles and zeros. We can now rewrite and get

20log(|H(ω)| ≈ 20log(|b0 |) − 20(p − q)log(ω)

Then it is commonly said that the asymptotic attenuation is


20(p − q) dB / decade.
ωp
3. The selectivity factor k. k = ωs .

(1−δp )−2 −1 0.5


4. The discrimination factor d. d = ( δs−2 −1
) .

11.2 Butterworth Filters


The Butterworth filter is one type of electronic filter design. It is designed to
have a frequency response which is as flat as mathematically possible in the
passband.
A LP Butterworth filter is defined in terms of its square magnitude frequency
response, i.e.
1
|H(ω)|2 =
1 + ( ωω0 )2N
where N is the filter order and ω0 is a parameter (both will be explained soon).
Let us look at an illustration of a square magnitude of the frequency response
for N = 3.

Figure 28: Butterworth low pass filter

The main properties of a LP Butterworth filter are:


1. The magnitude respons is monotonically decreasing function of ω.
2. The maximum gain occurs at ω = 0 and is |H(0)| = 1.
3. We can see that |H(ω0 )| = √1 , so the -3dB point is at ω0 .
2

4. The asymptotic attenuation at high frequencies is 20N dB/decade.

56
5. The square magnitude of the frequency response satisfies

∂ k |H(ω)|2

= 0, 1 ≤ k ≤ 2N − 1
∂ω k
ω=0

s
The transfer function of Butterwoth filter can be obtained by substituting ω = i
and then
1 1
|H(ω)|2 = H(s)H(−s) = =
1 + (s/iω0 )2N 1 + (−1)N (s/ω0 )2N

It can easily be seen that there are 2N poles for |H(ω)|2 which are
(N +1+2t)π
st = ω0 · e(i 2N )
, 0 ≤ t ≤ 2N − 1

The first N poles are located on the left side of the complex plane and therefore
belong to H(s) so it is stable. The remaining poles corresponds to H(−s).
A Butterwoth filter has no zeros, but the constant coefficient in the numerator
has to be adjust so |H(0)| = 1.
In summary a Butterwoth filter of order N is given by
N −1
Y −sk
H(s) =
s − sk
k=0

And the poles are

(2k + 1)π (2k + 1)π


sk = −ω0 · sin( ) + iω0 · cos( ), 0 ≤ k ≤ N − 1
2N 2N
Designing a Butterworth filter that meets your desired specification (i.e ωp , ωs , δp , δs )
proceeds as follows:
compute the factors k and d. From figure 28 it is obvious that
1 1
ω ≥ (1 − δp )2 , 2
ωs 2N ≤ δs
1 + ( ωp0 )2N 1 + (ω 0
)

which gives in turn


ωs 2N δs−2 − 1
( ) ≥
ωp (1 − δp )−2 − 1
so getting
1 1
( )2N ≥ ( )2
k d
Now one can calculate N :
ln( d1 )
N≥
ln( k1 )
and ω0 can be chosen anywhere in the interval

ωp ((1 − δp )−2 − 1)−1/2N ≤ ω0 ≤ ωs (δs−2 − 1)−1/2N

57
11.3 Chebyshev Filters
Chebyshev filters are analog or digital filters having a steeper roll-off and more
passband ripple (type I) or stopband ripple (type II) than Butterworth filters.
To understand Chebyshev filters we will make a short review of Chebyshev
polynomials. Chebyshev polynomial of degree N is defined as

cos(N · arccos(x)) |x| ≤ 1
TN (x) =
cosh(N · arccosh(x)) |x| > 1

Chebyshev polynomials can be constructed by the following recursive formula:

TN (x) = 2xTN −1 (x) − TN −2 (x), T0 (x) = 1, T1 (x) = x

The main properties of Chebyshev polynomials are as follows:


1. For |x| ≤ 1, |TN (x)| ≤ 1, and it oscillates between -1 and +1 a number of
times proportional to N .
2. For |x| > 1, |TN (x)| > 1, and it is monotonically increasing in |x|.

3. Chebyshev polynomials of odd orders are odd functions of x, and Cheby-


shev polynomials of even orders are even functions of x.
4. TN (0) = ±1 for even N and TN (0) = 0 for odd N .
5. |TN (±1)| = 1 for all N .

There are two kinds of Chebyshev filter. The first is equiripple in the pass-
band and then monotonically decreasing in the stop band, whereas the second
is monotonically decreasing in the pass-band and equiripple in the stop-band
(sometimes known as the inverse-Chebyshev).

11.3.1 Chebyshev filters - Type I


Chebyshev filter, Type I, is defined by the square magnitude frequency response
1
|H(ω)|2 =
1+ 2 TN2 ( ωω0 )

where N is the filter order, ω0 and  are parameters.


Let us look at an illustration of a square magnitude of the frequency response
for N = 2 and N = 3.

58
Figure 29: Chebyshev I low pass filter
(a) N=2 (b) N=3

The main properties of a Type I Chebyshev filter are:


1. For 0 ≤ ω ≤ ω0 (in this case ω0 = ωp ), we have
1
≤ |H(ω)|2 ≤ 1
1 + 2

2. (
1
2 1+2 N even
|H(0)| =
1 N odd

3. The asymptotic attenuation at high frequencies is 20N dB/decade.


In short a Chebyshev-I filter of order N has no zeros and is given by
N −1
Y −sk
H(s) = H0
s − sk
k=0

where the poles are


1 1 (2k + 1)π 1 1 (2k + 1)π
sk = −ω0 ·sinh( arcsinh( ))sin( )+iω0 ·cosh( arcsinh( ))cos( ), 0 ≤ k ≤ N −1
N  2N N  2N
and (
1 −0.5
( 1+2) N even
H0 =
1 N odd

59
Designing a Chebyshev I filter that meets your desired specification (i.e ωp , ωs , δp , δs )
proceeds as follows:
compute the factors k and d. From figure 29 it is obvious that
1 1
ω ≥ (1 − δp )2 , 2
ωs ≤ δs
1 + 2 TN2 ( ωp0 ) 1 + 2 TN2 ( ω0
)

for this equations to be satisfied, choose

ω0 = ωp ,  = ((1 − δp )−2 − 1)0.5

which will lead to


1 1 1
TN ( ) = cosh(N · arccosh( )) ≥
k k d
thus,
arccosh( d1 )
N≥
arccosh( k1 )

11.3.2 Chebyshev filters - Type II


Chebyshev filter, Type II, is defined by the square magnitude frequency response
2 TN2 ( ωω0 )
|H(ω)|2 =
1 + 2 TN2 ( ωω0 )

where N is the filter order, ω0 and  are parameters.


Let us look at an illustration of a square magnitude of the frequency response
for N = 2 and N = 3.

Figure 30: Chebyshev II low pass filter


(a) N=2 (b) N=3

60
The main properties of a Type II Chebyshev filter are:
1. For ω ≥ ω0 (in this case ω0 = ωs ), we have
2
0 ≤ |H(ω)|2 ≤
1 + 2
2. |H(0)|2 = 1 for all N .
3. In the limit as ω tends to infinity we have
2
(
22 TN2 (0) 1+2 N even
limω→∞ |H(ω)| = =
1 + 2 TN2 (0) 0 N odd

4. Asymptotic attenuation for even N is 0dB/decade.


For odd N the asymptotic attenuation is 20 db/decade.
The poles of the transfer function H(s) are proportional to those of type I from
the same order and are given by
ω02
vk = , 1≤k ≤N −1
sk
where
1 1 (2k + 1)π 1 1 (2k + 1)π
sk = −ω0 ·sinh( arcsinh( ))sin( )+iω0 ·cosh( arcsinh( ))cos( ), 0 ≤ k ≤ N −1
N  2N N  2N
Chebyshev filters of type II do have zeros. The zeros are at
iω0
uk = (2k+1)π
, 0≤k ≤N −1
cos( 2N )
In short a Chebyshev-II filter of order N is given by
N −1
Y vk (s − uk )
H(s) =
uk (s − vk )
k=0
(s−uk )
where uk is replaced by -1 if uk = ∞.
Designing a Chebyshev II filter that meets your desired specification (i.e ωp , ωs , δp , δs )
proceeds as follows:
compute the factors k and d. From figure 30 it is obvious that
2 TN2 ( ωωp0 )
≥ (1 − δp )2
1 + 2 TN2 ( ωωp0 )
2 TN2 ( ω
ωs )
0

≤ δs2
1 + 2 TN2 ( ω
ωs )
0

for this equations to be satisfied, choose


ω0 = ωs ,  = (δs−2 − 1)−0.5
which will lead to
1 1 1
TN ( ) = cosh(N · arccosh( )) ≥
k k d
thus,
arccosh( d1 )
N≥
arccosh( k1 )

61
11.4 IIR Filter Design
11.4.1 Impulse Invariance
The impulse invariance method of IIR filter design is based upon the notion that
we can design a discrete filter whose time-domain impulse response is a sampled
version of the impulse response of a continuous analog filter. If that analog
filter (often called the prototype filter) has some desired frequency response,
then our IIR filter will yield a discrete approximation of that desired response.
Implied in the correspondence of the continuous and discrete impulse responses
is the property that we can map each pole on the s-plane for the analog filter’s
Hc (s) transfer function to a pole on the z-plane for the discrete IIR filter’s H(z)
transfer function. What designers have found is that the impulse invariance
method does yield useful IIR filters, as long as the sampling rate is high relative
to the bandwidth of the signal to be filtered.
1. Obtain the Laplace transfer function H(s) for the prototype analog filter
in the form of
bN sN + bN −1 sN −1 + · · · + b1 s + b0
H(s) =
aM sM + aM −1 sM −1 + · · · + a1 s + a0
where M > N .
2. Select an appropriate sampling frequency fs and calculate the sample
period as ts = f1s .

3. Express the analog filter’s Laplace transfer function H(s) as the sum
of single-pole filters. This requires us to use partial fraction expansion
method.
M
bN sN + bN −1 sN −1 + · · · + b1 s + b0 X Ak
H(s) = =
aM sM + aM −1 sM −1 + · · · + a1 s + a0 s + Pk
k=1

th
where the individual Ak factors are constants and the k pole is located at
Pk on the s-plane. We’ll denote the k th single-pole analog filter as Hk (s)
i.e.
Ak
Hk (s) =
s + Pk
4. Substitute 1 − EXP (−Pk ts )Z −1 for s + Pk . This mapping of each Hk (s)
pole, located at s = Pk on the s-plane, to the location on the z-plane is
how we approximate the impulse response of each single-pole analog filter
by a single-pole digital filter, yielding
Ak
Hk (Z) =
1 − EXP (−Pk ts )Z −1
The final combined discrete filter transfer function H(z) is
M
X
H(z) = Hk (z)
k=1

Keep in mind that H(z) is not a function of time. The ts factor is a


constant equal to the discrete-time sample period.

62
5. Calculate the z-domain transfer function of the sum of the M single-pole
digital filters in the form of a ratio of two polynomials in z. Because the
H(z) will be a series of fractions, we’ll have to combine those fractions
over a common denominator to get a single ratio of polynomials in the
familiar form of PN −k
k=1 bk z
H(z) = PM
1 − k=1 ak z −k
Because the process of sampling the continuous impulse response results
in a digital filter frequency response that’s scaled by a factor of f rac1ts ,
many filter designers find it appropriate to include the ts factor. So we
can rewrite PN
ts k=1 bk z −k
H(z) = PM
1 − k=1 ak z −k
Incorporating the value of ts makes the IIR filter time-response scaling
independent of the sampling rate, and the discrete filter will have the
same gain as the prototype analog filter.

6. We can express the filter’s time-domain equation in the general form of

yn = ts (b0 xn + b1 xn−1 + · · · + bN xn−N ) + a1 yn−1 + · · · + aM yn−M

notice the ak coefficient sign change.

63
11.4.2 Bilinear Transform IIR Filter Design
There’s a popular analytical IIR filter design technique known as the bilinear
transform method. Like the impulse invariance method, this design technique
approximates a prototype analog filter defined by the continuous Laplace trans-
fer function H(s) with a discrete filter whose transfer function is H(z). The
method won’t be explained here. We will just show the design steps.
1. Obtain the Laplace transfer function H(s).

bN sN + bN −1 sN −1 + · · · + b1 s + b0
H(s) =
aM sM + aM −1 sM −1 + · · · + a1 s + a0

2. Determine the digital filter’s equivalent sampling frequency fs and estab-


lish the sample period ts = f1s .

3. In the Laplace H(s) transfer function, substitute s with the expression

2 1 − z −1
( )
ts 1 + z −1
to get the IIR filter’s H(z) transfer function.
4. Multiply the numerator and denominator of H(z) by the appropriate
power of (1 + z 1 ) and bring H(z) to the form
PN −k
k=1 bk z
H(z) = PM
1− k=1 ak z −k

5. Just as in the impulse invariance design methods, by inspection, we can


express the IIR filter’s time-domain equation in the general form of

yn = b0 xn + b1 xn−1 + · · · + bN xn−N + a1 yn−1 + · · · + aM yn−M

64
REFERENCES
1. Understanding digital signal processing / Richard G. Lyons.
2. A Course in digital signal processing / Boaz Porat.
3. Shaum’s signals and systems
4. Shaum’s outline of theory and problems of digital signal pro-
cessing

65

Das könnte Ihnen auch gefallen