You are on page 1of 46

EC448 notes

Review:

a- Difference Equation:

homogeneous equation

assume

since

where are the roots of the equation and is the homogenous solution.
Note that when , which is the impulse response.
The impulse response must satisfy the homogeneous difference equation for n > 0.
The constants are evaluated using the initial conditions for .

b- Linear Systems and Convolution:

if , then

x(n) h(n) y(n)

Let where is the impulse response of the discrete system

for LTI (Linear Time Invariance) system, we have


Since any input sequence can be written as ,

applying to the LTI system above yields

c- Frequency Response of Discrete-Time Systems:

Let for
define
is the frequency response of the system whose impulse response is

Consider:

1

n
0 N-1

Since is a periodic function of , it can be represented by a Fourier series and


is its Fourier coefficients.

and

the above can be applied to any convergent sequence since it is periodic in the
frequency domain.
← DTFT

Example 1:
Ideal Lowpass Filter ( zero phase )(no delay)

is not causal.

d- Ideal Filter Response: (only input signal delay)(linear phase)


→ → , and

for an ideal low-pass filter with constant-amplitude response and linear phase response

and
where is the fundamental frequency of a square wave input

→ )
→ ← no distortion with linear phase.
Also, for linear phase system and is maximum at
proof:

→ max at also since →

H(jω) H(jω)

ω ω
-τω
-τω
e- Z-Transform
← two-sided, if the sum starts from zero, then one-sided

→ →

for , i.e., for , the z-transform is equal to the Fourier transform of the sequence.

Example2: → for or the geometric series

converges to or is ROC

Im Z-plane

o x Re

Inverse z-Transform:

Assume is a rational function, we consider three methods: inversion by series expansion,


by partial fraction, and by use of an inversion integral. For the same pole-zero locations, there are
different regions of convergence ROC (right-sided, left-sided, two-sided).We must know ROC in
advance to determine . Note that the frequency response

* In the case where is nonzero for both positive and negative indices, it is imperative to realize that
itself cannot uniquely determine the sequence .
Example 3: and both have z-transform equal to

→ given and its ROC uniquely specify the sequence .

The Discrete Fourier Transform (DFT)

DFS:
period and integer

- No z-Transform exist i.e.; periodic sequence, there is no ROC for z.


- Fourier series in complex exponential (DFS).
- N distinct complex exponential having a period that is an integer sub-multiple of the fundamental
period N.

→ Fourier series of has finite coefficients


are the Fourier coefficients.
To solve for the coefficients, multiply both sides by and summing from to
using the fact that ← geometric series

or
The sequence is periodic with period of N → .
Define

→ DFS pair

and

let , the z-transform of the sequence is given by

The periodic sequence has a convenient interpretation as samples on the unit circle, equally spaced
in angle, of the z-transform of one period of .This then corresponds to sampling the z-transform
X(z) at N points equally spaced in angle around the unit circle.

Z-plane
2π/N

Example 4: Periodic sequence


→ multiplying by yields
the z-transform of evaluated over one period

→ or

* Comparing sampling values at of to that of i.e.;

→ → and
→ → rad
when (beginning of the next period), the values repeat.
Properties of DFS:
-shift of a sequence:
if → then →
-periodic convolution:
let and be periodic sequences of period , then is periodic
with period N. .

Sampling the z-Transform:

Consider aperiodic sequence with finite duration , its X(z) has ROC that includes the unit circle, a
condition that is always met for finite sequence
Evaluating the z-transform at N equally spaced points around the unit circle and as we have seen before
this equivalent to:

where

since , we have

since


* frequency domain sampling is similar to time domain sampling.
* if the aperiodic sequence is of finite duration less than N, then each period of
is the exact replica of .
*if is of duration less than N, it can be recovered exactly from
* if is of duration greater than N, there will be an overlap of nonzero samples (aliasing).

In conclusion, a finite duration sequence of length N or less can be represented exactly


by N samples of its z-transform on the unit circle. It follows also that X(z) can be recovered from these
same samples.

if for , then and since for

*The above equation expresses , the z-transform of a finite duration sequence of


length , in terms of “frequency samples” .

DFT:

by extracting one period and from their perspective periodic sequences

and

we can define the transform pair (DFT) as:

and

-properties of DFT:
* everything is based on the periodic sequences

1- Linearity
both and need to be of the same length N.
if , we add ( ) zero values to .

2-Circular Shift:

3-Circular Convolution:

Example 5: let be a finite duration sequence of length N and where .


for and ,

Example 6:
note:

consider now and as length sequences by augmenting zeros. If a -point circular


convolution is performed, we obtain a sequence that has the same result as if the linear
convolution is performed on the and length original sequences.
Linear Convolution using DFT:
- DFT is basically extracting one period from DFS, hence circular shift and periodic convolution
must be used.
- to achieve linear convolution thru periodic convolution ( as was shown by an example previously )
the original finite duration sequence must be augmented by additional zeros such that in general
if is of length and has is of length , both sequences will be of new length
.
In some cases we would like to convolve a finite duration sequence with a sequence on indefinite
duration, as for example in filtering a speech waveform. In general we would segment the signal into
sections of length . Each section can then be convolved with the finite duration unit-sample response
and the filtered sections fitted together in the appropriate way.
Two methods are discussed:
Assume the unit-sample response is of length M.
1- Overlap-add method:

decompose x(n) into sum of sections, each section having only nonzero points


2- Overlap-save method:
in this method we would section x(n) into sections of length so that each input section overlapped
the preceding section by points.
Discrete Cosine Transform DCT

to be added later
Block-diagram representation of Digital Filters

1-IIR Systems ( Infinite Impulse Response)


Consider linear shift-invariant discrete-time system that is represented by the rational system function
above, there corresponds a variety of different block diagram configuration. One consideration in the
choice between these different realization is computational complexity. That is, diagrams with fewest
constant multipliers and fewest delay branches are often most desirable.
a- Direct Form I

b- Direct Form II

c- cascade form
d- Parallel Form

2- FIR Systems:
Consider causal systems with finite duration response. The output y(n) depends only on
and its past values. This type of circuit is called non-recursive.
or


has poles at and zeros that can be anywhere in the finite z-plane.
a- Direct Form:
which follows directly from the convolution
b- Cascade Form:

in the graph

Linear-Phase FIR systems:


- no phase distortion
-phase shift is linear
signals falling in the entirely in the passband will be reproduced with a delay equal to the slope of the
phase curve. One of the most important features of FIR systems is that they can be designed to have
exactly linear phase. The unit impulse response for a causal FIR system with linear phase has the
property that

for N even

for N odd

for the frequency response

for N even

for N odd

in both cases, the sums are real, implying a linear phase shift corresponding to delay of
samples. This implies Direct-Form implementation which require N/2 (N even) or (N+1)/2 (N odd)
multiplications rather than N.
M=N and N is even

M=N and N is odd

Imposing the symmetry condition on the coefficients of the polynomial causes the zeros of to
occur in mirror-image.

Nonlinear Phase
Example 7: Perform the running average of the last six digital samples.

or

note that → linear phase

the poles are all located at the origin of the z-plane and the zeros are at
0.5000 + j0.8660
0.5000 - j0.8660
-1.0000 + j0.0000
-0.5000 + j0.8660
-0.5000 - j0.8660
note: usually when plotting magnitude and phase, we use normalized frequency range i.e.;

since and for → → or

Example 8:
given and estimate the tone frequency using DFT.

max at and

if number of k samples increased to 2001, we get


note that the new x(n) would be 21 +1980 zeros ( new period is 2001 samples )

Digital Filter Design Techniques


Example 9:
x(t)

0 1 t

taking 10 samples as shown from the figure above



plots are for and ,

*see page 181 (Applied Digital Signal) for matlab phase functions angle(x) and atan2(x)
We will adopt the notation being the digital radian frequency or angle and being the analog radian
frequency per cycle as shown by the above figure.

← passband
← stopband
transition band of nonzero width
- many of the filters used in practice are specified by such a tolerance scheme, with no constraints on
the phase response other than those imposed by stability and causality requirements; i.e., the poles of
the system function must be inside the unit circle.

a- Design of IIR Digital Filters from Analog Filters:

In transforming an analog system to a digital system we must therefore obtain either H(z) or h(n) from
the analog filter design. This implies that we want the imaginary axis of the s-plane to map into the unit
circle of the z-plane. A second condition is that stable analog filter should be transformed to a stable
digital filter.That is, if the analog system has poles in only in the left-half s-plane, then the digital filter
must have poles only inside the unit circle.

1- Impulse Invariance method


Consider where is the sampling period,
we and

we also have from discrete-time FT

let

let → and

or

→ and since


Ω s-plane

3π/T z-plane

π/T

1
-π/T

-3π/T
stripes of width in s-plane map into the entire z-plane. The left half of each z-plane strip maps
inro the interior of the unit circle.The right half plane of each s-plane strip maps into the exterior of the
unit circle. The imaginary axis of the s-plane maps into the unit circle in such a way that each segment
of length is mapped once around the unit circle.

because the in practice the analog filters are not band limited (hence aliasing in the sampled filter), the
digital filter will not be identical to the original analog filter frequency response.
Also, T in this method does not have effect on the amount of aliasing in the impulse invariant design
procedure ( ).

Let →

the unit-impulse response

since

and from the z-transform of for

→ where
→ in s-plane maps into in z-plane so that if the real part of the is less
than zero ( left-half s-plane), then is less than unity ( inside unit-circle), and if
the real part of of is greater tha zero (right-half s-plane ) , the is greater
than unity (outside unit-circle ). If ,however, , then (unit-circle ).

note: while the poles in the s-plane map to poles in the z-plane according to the relation
, it is important to recognize that the impulse invariant design procedure does nor correspond
to a mapping of the s-plane to the z-plane by that relation or in fact by any relation. The zeros
of the digital filter are a function of the poles and the coefficients .
Example 10:

second order filter with, jΩ z-plane


zeros:
π/T
a
poles: b bT

-π/T

2-Numerical Solution of the Differential Equation:


→ and
in general,
taking the z-transform of the approximated differential equation, yields

and comparing with

To see how the axis maps into the z-plane: we have

and let →
z-plane

s-plane

σ 0 1

3- Bilinear Transformation
It is based on integrating the differential equation and then using a numerical approximation to the
integral (Trapezoidal rule:
or ).

Consider the first order differential equation and


or →
if and ,

using Trapezoidal rule →

but
where

taking the z-transform and solving for gives

comparing and →

This also hold true for the order differential equation of the form given earlier, since
it can be written as a set of first-order differential equations.
The above invertible transformation is recognized as a bilinear transformation.
Mapping :
a- for and is negative ( left-half plane), the numerator magnitude is always
less than that of the denominator, and so the values are interior of the unit-circle.

b- for is positive (right-half plane ), the numerator magnitude is always


greater than that of the denominator, and so the values are exterior of the unit-circle.

c- for , the numerator magnitude is always equal that of the denominator, and so the
values are always on the unit-circle.
jΩ z-plane
s-plane
s=jΩ

σ 1

The bilinear transformation


avoids the problem of aliasing encountered with the use of impulse
invariance because it maps the entire imaginary axis in the s-plane onto the unit-circle in the
z-plane. The price paid for this is the introduction of a distortion in the frequency axis. Consequently,
the design of digital filters using bilinear transformation is only useful when this distortion can be
tolerated or compensated.

for imaginary axis and for unit-circle

Typical frequency selective analog filter designs are Butterworth, Chebyshev, and elliptic filters.
These analog approximation methods have closed-form design formulas which make the design
procedure straightforward. A Butterworth analog filter is monotonic in the passband and in the
stopband. A chebyshev filterhas an equiripple in the passband and monotonic in the stopband.
An elliptic filter is equiripple in both passband and stopband.Using bilinear transformation will
preserve these properties as shown below
Analog-Digital Transformation

Digital Butterworth Filters:


Butterworth filters are defined by the property that the magnitude response is maximally flat
in the passband. For an Nth-order filter this means that the first derivatives of the squared
magnitude function are zero at .Another property is that the approximation is monotonic in the
passband and the stopband. As N increases , the sharper the filter gets. The magnitude at the cutoff
frequency , will always be , note also |

The roots of the denominator polynomial (the poles of the squared magnitude ) are at
. Utilizing the fact( )→ where
, and . Therefore, there are poles equally spaced in angle on a
circle of radius in the s-plane. The poles are symmetricly located with respect to the imaginary axis
and one occurs on the real axis for odd. The angular spacing between the poles is ( ex: →
). If we restrict the filter to be stable and causal, then these poles will correspond to the ones
on the left-half s-plane.

s-plane
Ωc
o
60
Note:
to assure that →
Example 11:
Assume we require a filter such that the passband magnitude is constant to within
for frequencies below and the stopband attenuation is greater than for frequencies
between and . Thus, if the passband magnitude is normalized to unity at , then

and

1- Impulse Invariant Design.


Recall that impulse invariance corresponds to linear mapping ( )from analog frequency to digital
frequency in the absence of aliasing ( assume aliasing is negligible ). Assume T is unity.

→ and

since , the filter design consists essentially of determining the parameters


and .

or

also, we will have

The solution of these two equations gives and .


Since has to be integer, we let and this gives the three pole pairs in the left-half
s-plane:
has solutions given by }

0
1
2
3
4
5
6
…. ……. ……………….
since , the poles on the left-half s-plane are chosen for stability and causality. Also
to assure , we have

expressing as partial fraction and perform the transformation ,

It is evident from the above equation, the system function resulting from the impulse invariant design
method can be realized directly in parallel form.
2-Design Using the Bilinear transformation

→ and so

is then obtained by applying the bilinear transformation ( ) to with


Digital Chebyshev Filters

Allowing equiripple behavior in either passband or stopband rather than monotonic, will
distribute the accuracy of the approximation uniformly over the passband or the stopband or both.
Usually this also leads to lower-order filter.

where is the Nth-order Chebyshev polynomial defined as


→ , → and →
In general, and varies between zero and unity for x between zero
and unity. For x greater than unity , is imaginary and consequently increases
monotonically. ripples between 1 and for and decreases monotonically
for x greater than as shown by the figure. The roots of the equation
are at: → →

where , , and .
The poles of the Chebyshev filter lie on an ellipse in the s-plane. The ellipse is defined by two circles
with radius ( inner circle) and ( outer circle) where and
with .

Example 12:
Consider the same filter specs as that of the previous example.

1- Impulse Invariant Design.

and

at we have or or

or →

also, or

or →

for → , and for → .

→ and

0
1
2
3
4
5
6
7

(N is even)
using partial fraction for impulse invariance transformation

2- Bilinear Transformation:

and

and
so as before

note:

again for →
and for →
this results in the same value for , which means and are also the same.
The only value changed is . Note that is also the same.
0
1
2
3
4
5
6
7
Elliptic Filters
Equiripple in both passband and stopband
where is a Jacobian elliptic function.

Matlab IIR digital filter design:


1-butter 2- cheby1 3- cheby2 4- ellip

Matlab IIR filter order selection:


1- buttord 2- cheb1ord 3- cheb2ord 4- ellipord

Frequency Transformation of Low-pass IIR Filter:

FIR Digital Filters:

Advantages:
a- Computational speed of FFT and implement a filter as finite-duration impulse response.
b- FIR can have exactly linear phase.

The system function of a causal FIR filter is of the form

has zeros that can be located anywhere in the finite z-plane and poles all of
which lie at . Recall that any finite-duration sequence is completely specified by N samples
of its Fourier transform , so that the design of an FIR filter may be accomplished
by finding either its impulse response coefficients or samples of its frequency response.
In the following both methods are discussed.

From the the property of linear phase FIR filter , it was shown that
linear phase shift corresponding to a delay of samples (for N odd it is an integer plus one-half sample).

* linear phase is generally desirable and often a necessity


* linear phase often simplifies a design procedure.

As with IIR filter design, we saw two design approaches: time domain approach ( impulse
invariance) and frequency domain approach ( Bilinear transformation), the same thing can be said for
the design of FIR filters: time domain approach ( Windowing ), and frequency domain approach
(Computer-Aided Frequency-Sampling) and (Comuter-Aided Equiripple Approximation).

1- Design of FIR Filters Using Windows

Because the frequency response of is periodic with period , (IIR ) can represent the
Fourier coefficients of the infinite series and
Truncating ( FIR) will produce a least mean square error that will depend on the window
used.
Example 13:
Suppose we wish to design an FIR filter of length 11 that approximates a low-pass with cutoff
frequency of for sampling frequency of .

→ →

for 11 coefficients

the impulse response is noncausal. To obtain a causal response we shift the impulse response so that
becomes ( linear time-invariant casual system property for all ). This process delays
the output by an amount of the shift.

let →

x(n)
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1
z z z z z z z z z z

1/5π -1/3π 1/π 1/2 1/π -1/3π 1/5π

y(n)

In general, can be seen as the product of and a window sequence :

where
which expresses as circular convolution because and are both periodic in with
period of .

and where
Types of Windows:

Rectangular
Triangular/
Bartlett
Hanning

Hamming
Kaiser windows are another type where windows parameters can be adjusted for optimal results.
2- Computer-Aided Design of FIR Filters

choose so that it minimizes the expression

a- Frequency sampling Design

if we let

or
the above equation suggests a simple approach to filter design, i.e., to specify the filter in terms
of samples of one period of the desired frequency response
relying on the interpolation indicated by the equation stated above to fill in the gaps in the
frequency response.

Example 14:
is the frequency response of an ideal low-pass filter with . The number
of samples is taken to be .

frequency spacing is →

between the 8th and 9th samples.

The impulse response can be obtained using IDFT,

consider linear phase filter where

since

for real coefficients , the imaginary part has to be zero


apart from , we have , , ….

is odd

is even

Example 15:

Design FIR low-pass filter with and using 9 frequency samples

|H(ω)|

ω
0 1 2 7 8
π 2π k

0 1
1 1
2 0.5
3 0
4 0
5 0
6 0
7 0.5
8 1

Note that the samples at k = 2 and k = 7 are taken as 0.5 rather than 1 or 0. By using the average of the
two extreme values, we will design a much better filter, i.e. one that satisfies the specification more
closely than if either 1 or 0 had been used.

since is odd, we have


x(n)
-1 -1 -1 -1 -1 -1 -1 -1
z z z z z z z z

-0.0556 0.0453 0.3006 0.3006 -0.0556 -0.0126


-0.0126 0.4444 0.0453

y(n)
note that we could have used the equation instead to

plot the magnitude.


to be examined again!!!!

b- Equiripple Approximation

Consider the zero phase FIR filter and


for zero-phase we require
note that causal system can be obtained by delaying by samples.

→ is pure real

H(e^jω)

1+δ1
1
1-δ1

δ2
ωp ωs ω
-δ2 π

Suppose that we wish to design a low-pass filter according the tolerance scheme of the figure above.
Approximate 1 in the band with maximum error and approximate zero in the band
with maximum error .

Two distinct approaches have been developed. Herrmann and Schuessler(Nonlinear equation solution
for maximal ripple FIR filters), and later Hofstetter(Polynomial interpolation solution for maximal
ripple FIR filters) developed procedures in which are fixed and and are variable.
Parks and McClellan and Rabiner developed procedures(Weighted Chebyshev approximation) in
which are fixed and and are variable.

where

and

The design procedure is to minimize . It turns out that there are at least alternations
with and contained in the intervals and as shown by
the figure below for . For a low-pass filter the desired frequency response is piecewise constant
and the frequencies correspond to peaks in the error function . is constrained such that
and and it will always have a local maximum or minimum at
and . Therefore a low-pass filter response has either or alterations of the error
function.
Matlab functions for Parks-McClellan ( firpm , firpmord).

You might also like