Anda di halaman 1dari 113

A

Course on
Digital Filter Design
&
Realization, with Multirate DSP
By
Pragnan Chakravorty
Director, CARET
M.Tech (IIT Kharagpur), Member-IEEE(USA), ACM(USA)
Member IEEE :-
Communication. Soc,
Microwave Theory and Techniques Soc,
Antenna & Wave Propagation. Soc
Clique for Applied Research in Electronic Technology
Advaita Corporation
CONTENTS
1. Filters are Ideally Linear Time Invariant systems
2. What are Filters?
3. The Transfer Function
4. Lets begin with Butterworth low pass characteristics
5. Where is Digital Filter (Bilinear Transform)?
6. Warping
7. Where are we?
8. Digital filter Design Flow Diagram
9. Finite Impulse Response (FIR) Filter Design
10. Fourier Transform Method
11. Window Method
12. Frequency Sampling Method
Filters are Ideally Linear Time Invariant systems
Ret
What are Filters?
In the present context, filters are systems which accept and reject Signals
based on criterion set upon their frequencies. Following are the types of
filters
Ret
Whether or not obvious at this moment, Ideal Filters are unrealizable. Practical
filters are designed to bring it as close as possible to the ideal case. Though our
objective is to design digital filters, well begin with analysis of analog filters.
Lets analyze a low pass filter circuit which we are already familiar with.
Here:
Transfer Function
Lets use a simple MATLAB code below to plot G(j) versus radian frequency
w=0:0.02:10; RC=1; magGjw=1./sqrt(1+(w.*RC).^2); semilogx(w,magGjw);...
xlabel('Frequencyin rad/sec log scale'); ylabel('Magnitude of Vout/Vin');...
title('MagnitudeCharacteristics of basic RC low-pass filter'); grid
MATLAB
Phase Response
w=0:0.02:10;RC=1;phaseGjw=-atan(w.*RC).*180./pi;semilogx(w,phaseGjw);
xlabel('Frequencyin rad/sec - logscale');
ylabel('Phaseof Vout/Vin- degrees');
title('PhaseCharacteristics of basic RC low-pass filter'); grid
Similarl y HPF,BPF & BRF can be presented. Transfer functions are simulated
below
HPF
BPF BRF
The Transfer Function
It should be quite clear by now that as far as computations are concerned, it is
the transfer function which is calculated every time to find a filters frequency
response. Moreover transfer functions are not dependent on I/P or O/P of
systems and they completel y characterize the systems in frequency domain.
Therefore, to anal yze and design a filter system we onl y need its transfer
function to be known. The input signal is directl y multiplied with the transfer
function to get the desired filtered output. Signal Processing is all about
computations, whether analog or digital filters, onl y transfer functions are
anal yzed and designed here. Henceforth onl y transfer functions are talked
about and not their circuit implementations.
G(s)
s = jw
V
out
V
in
=
out
in
in out
V
G(s);
V
V G(s)=V
Ret
So far, was this filter design?
Although we computed and simulated all kind of filters so far, a very important
question still remains to be answered- Was this filter design? No, it was not. Up till
now, we could onl y anal yze given circuits and calculate their transfer functions.
Precisel y, we could not specify the cutoff frequency, bandwidth, attenuation etc
according to our wishes. We had to accept whatever characteristics the filters
had.
What is Design?
The other word for design is synthesis. So far, from a given circuit/transfer
function its characteristics(result) was calculated or anal yzed. In Design- from a
given characteristics(result) the circuit/transfer function is synthesized. In design
or synthesis, characteristics(result) are specified according to our wishes, viz. we
can specify- bandwidth of the pass band, stop band attenuation, cutoff frequency
etc, and the corresponding circuit or transfer function is synthesized to satisfy all
our specifications.
Hitherto, the difference between analysis and synthesis should be conspicuous.
Lets begin with Butterworth low pass characteristics
It should be noted that our design starts with the final desired result here it is the
Butterworth low pass filter characteristic pol ynomial. A
2
(w) is known as the
magnitude squared function. w
c
is the 3dB cutoff frequency
Ret
Remember,A
2
(w) is not G(s). Its a long way to go, G(s) is the final answer of the
design
Why not take a design example?
Example 1
Derive the transfer function for the third order (k=3 ) Butterworth low-pass filter
with normalized cutoff frequency w
c
=1rad/sec .
For k=3, w
c
=1rad/sec: substitutings
2
=(jw)
2
=-w
2
:
Poles of the above functionare six in numbers and are locatedat
these six poles lie on the circumference of the circle with radius w
c
=1rad/sec as
shown. The transfer function is formed by left half plane poles s
3
s
4
and s
5.
therefore G(s) is as given below:
Since we have matlab in hand, we can use syms and expand, the symbolic
object evaluators to simplify the denominator of G(s). Matlab code is
executed below
syms s; den=(s+1/2-sqrt(3)*j/2)*(s+1)*(s+1/2+sqrt(3)*j/2)
den =
(s+1/2-1/2*i*3^(1/2))*(s+1)*(s+1/2+1/2*i*3^(1/2))
expand(den)
ans =
s^3+2*s^2+2*s+1
Therefore G(s) simplifies to:
The above G(s) is the desired transfer function for third order k=3 Butterworth low
pass filter with normalized cutoff frequency w
c
=1rad/sec


3 2
1
G(j )=
-j - 2 +2j +1
Substituting s=jw; Matlab code is simulated below
If we can determine the various values- a
0
a
k
and b
0
then our synthesis of
transfer function will be over. Following the procedure of above example
coefficients for k=1 to 5 at normalized frequency w
c
=1rad/sec are tabulated below
Values of the coefficients a
i
for k=1 to 5
The table which we just saw is for normalized frequency w
c
=1rad/sec.The transfer
function corresponding to actual cutoff frequency can be obtained from the
relation given below
For
w
norm
= w
c
=1rad/sec
The desired stop band attenuations can be calculated by plotting A
2
(w) in dB
which is 10log|A
2
(w)| vs w for various values of k. Computing this in Matlab we
get
REF
Now we are ready for next example
Example 2
Using the attenuation curves above, derive the transfer function of a Butterworth
lowpass analog filter with pass band bandwidth of 5 rad/sec , and attenuation in
the stop band of at least -37dB for frequencies larger than 15 rad/sec.
We refer to figure above and at
C
=15 5=3, we see that the vertical line at this value
crosses the k=4 curve at approximately -37dB which satisfies our requirement.
Therefore
After further evaluation
Simulating with MATLAB
Chebyshev Type-I Filters:
What about HPF, BPF,BRF?
Following are the transforms used to convert low pass filters to other types by
transforming the complex variable s.
Its time to design a band-pass filter
Example 3
Compute the transfer function for a third-order band-pass Butterworth filter with
3dB pass-band from 30Krad/sec to 40Krad/sec , from a third-order low-pass
Butterworth filter with normalized cutoff frequency.
From tables outlined before for w
c
=1rad/sec, we get G(s) as below
Replacing s by
G(s)=1/(s^3/(w2-w1)^3+3*s/(w2-w1)^3*w1*w2+3/s/(w2-w1)^3*w1^2*w2^2+1/s^3/(w2-
w1)^3*w1^3*w2^3+2*s^2/(w2-w1)^2+4/(w2-w1)^2*w1*w2+2/s^2/(w2-
w1)^2*w1^2*w2^2+2*s/(w2-w1)+2/s/(w2-w1)*w1*w2+1)
Much difficult to decipher though, its not the case with MATLAB, Plotting the
transfer function in MATLAB
Difference Between an Analog and Digital Filter
Analog Filter Digital Filter
Analog filters are circuit
implementations with resistors
capacitors inductors etc
Programs like MATLAB together with
computer can only simulate analog
filters
Analog filters process analog signals
Analog Filter hardware can not do
anything else than filtering
Digital filters are computational process
implemented with algorithms
Programs like MATLAB together with
computer create digital filters
Digital filters process discrete and
digital signals
Dedicated hardware known as DSP
processors (e.g.. TI- TMS320C6713 DSK)
are microprocessors and can do almost
all computational work other than
filtering
Where is Digital Filter?
We may intuitively understand that digital systems are discretized versions of
their analog counterpart. We also know that the role which is taken by Laplace
transforms in analog systems, the same is taken by Z transform in digital domain.
Therefore to make a digital filter from analog filter we just need to change the
transfer function from Laplace domain to Z domain. Such a Change is known as
Bilinear transformation.
G(s)
V
out
(s) V
in
(s)
G(z)
V
in
(z)
V
out
(z)
I
m
p
u
l
s
e

I
n
v
a
r
i
a
n
t
T
r
a
n
s
f
o
r
m
a
t
i
o
n
Ret
B
i
l
i
n
e
a
r
T
r
a
n
s
f
o
r
m
a
t
i
o
n
Bilinear transformation uses the transformation
to transform the left-half of the s-plane into the interior of the unit circle in the z
-plane. We will discuss only the bilinear transformation in the present context.
*T
s
is the sampling rate which is reciprocal of sampling frequency f
s
Analog and Digital Frequency
In above expression w
a
is analog frequency and w
d
is digital frequency
Warping
The following Bilinear transformation is also used
and
Ret
Impulse Invariant Transform
It is obtained by sampling the impulse response of analog filter
h(n)= h
a
(nT
s
)
i s
i s
M M
i i
pT -1
i=1 i=1
i
pT -1
i
A A
if H(s) = then H(z) =
s- p 1-e z
the mapping formula is:
1 1
s- p 1-e z


The H(s) can be broken into partial fractions and impulse invariant method be
used, for example:
1 2 1
1
1 2
1 1 1
( )
( 1)( 2) ( 1) ( 2)
1 1
( )
(1 ) (1 )
0.2326
( )
1 0.5032 0.0498
T T
If H s
s s s s
then H z
e z e z
z
H z
z z


= =
+ + + +
=

=
+
Example 4
Compute the transfer function G(z) of a low-pass digital filter with 3dB cutoff
frequency at 20Hz and attenuation of at least 10dB for frequencies greater than
40Hz . The sampling frequency f
s
is 200Hz
From the preceding examples on analog design we can calculate that the
following G
n
(s) meets the design requirements
After further simplification
Evaluating the Matlab Code
bz=[0.0675 0.1349 0.0675]; az=[1 1.1429 0.4127]; [Gz, wT]=freqz(bz,az,20,200);
semilogx(wT,abs(Gz)), axis([0.1 1000 0 1]), hold on;
title('Digital Low-Pass Filter'), xlabel('Frequency in Hz'), ylabel('Magnitude'),grid
Low pass digital IIR specifications can also be given as:
Warped frequencies are given by:
Here i is any subscript
For Butterworth Filters the order N and cutoff frequency
c
can be related to above
specifications as follows:
General transfer function G(s) for any polynomial function can be written as:
Butterworth coefficients are given by:
A is the gain of G(s) which is =1 for passive filters
For Chebyshev Filters the order N and cutoff frequency
c
can be related to the filter
specifications specifications as follows:
Chebyshev coefficients are given by:
A is the gain of G(s) which is =1 for passive filters
Where are we?
We must ponder now what is our current status of learning digital filter.
Are we done with it? If not , then what else should be learnt to complete
it.
What are the possible classifications of digital filter design.
We know how to obtain digital filter from analog design using bilinear
transform
We need to know what are FIR and IIR filters
We need to know that if digital filters are broadly categorized under IIR
and FIR then under which category would bilinear transform fall and why?
Ret
Digital Filter Design
Frequency
sampling
method
IIR Design
Transient / Time Domain Approach Spectral / Frequency Domain Approach
Introduce
delay to
make
causal
impulse
response
Window
method
FIR Design
Pole-zero
placement
design
Impulse
invariant
design
Bilinear
transform
ation
Analog
Design
Low pass
prototype
Transform
to other
types
Warping
Bilinear
transformation
Window
function
Removal of
Gibbs
Oscillations
Fourier
transform
method
Final
Design
Final
Design
Truncation
of IIR to
make FIR
Fourier
transform
method
Final
Design
Ret
Answer Me
Why is Bilinear transform associated with spectral approach?
In our study so far whether analog or digital we analyzed and synthesized
transfer functions only which are frequency/spectral domain quantities.
Therefore, not just bilinear transformation but our entire study so far had been
frequency domain study.
Why is FIR associated with spectral approach?
From signals and systems we know that the quantity which is known as
transfer function in frequency domain ,is known as impulse response in time
domain.
Therefore a design which synthesizes impulse response instead of transfer
function is associated with transient/time-domain design and Finite impulse
response (FIR) is one of those.
What is Finite about FIR?
To explain this let us look at the impulse response of an ideal filter
Transfer Function
Impulse Response
Frequency Domain
Time Domain
We can observe that the impulse response of an ideal filter is indeed infinite and
is therefore non-causal. Since non-causal impulse response can not be practicall y
implemented in time domain therefore it is truncated and made finite (FIR) and
that is finite about FIR.
If IIR is to time domain then why is it tagged in frequency domain?
We could see that IIR is not possible to implement in time domain because of its
non-causal nature. On the other hand in frequency domain approach since we do
not deal with impulse response therefore we never truncate it, as a result all
transfer functions in frequency domain approach result in infinite impulse
response (IIR). This means that IIR design is to frequency domain approach.
Lets again have a look at the different categories, types and stages of digital filter
design to understand them better
Digital Filter Design
Frequency
sampling
method
IIR Design
Transient / Time Domain Approach Spectral / Frequency Domain Approach
Introduce
delay to
make
causal
impulse
response
Window
method
FIR Design
Pole-zero
placement
design
Impulse
invariant
design
Bilinear
transform
ation
Analog
Design
Low pass
prototype
Transform
to other
types
Warping
Bilinear
transformation
Window
function
Removal of
Gibbs
Oscillations
Fourier
transform
method
Final
Design
Final
Design
Truncation
of IIR to
make FIR
Fourier
transform
method
Final
Design
Ret
Finite Impulse Response (FIR) Filter Design
Whatever filter design we did till now was IIR design where we did not truncate
the impulse response but now it is turn to study FIR design which is a time
domain approach and thus it truncates the impulse response.
Why FIR?
To answer this lets compare pros and cons of both the designs
FIR Gives Linear phase response with
in the pass band
FIR has more number of side lobes in
stop band than IIR
FIR has more computational
complexity and engages more
memory
IIR has mostly non linear phase
response
IIR has much lesser number of side
lobes in the stop band
IIR has lesser computational
complexity and engages lesser
memory
Finite Impulse Response (FIR) Infinite Impulse Response (IIR)
Ret
Fourier Transform Method
As we could see that all ideal filters take the shape of a gate function in
frequency domain ,therefore, they are sampling function in time domain (from
Fourier transform). The impulse response hence, is a sampling function and is
IIR in nature. IIR makes the transfer function non causal therefore following
steps are taken to make the impulse response and transfer function causal:
1
5
4
3
2
Ideal filter
Transfer Function
Infinite Impulse
Response (Non-Causal)
Finite Impulse Response
(Non-Causal)
Finite Impulse Response
(Causal)
Designed filter
Transfer Function
Current time n=0
Ret
From Fourier transform of gate functions and subsequent truncation of impulse
responses, following table is made to obtain impulse responses of different type
of filters
j
1( )
for H(z) =H(e )
0( )
passband
stopband

`
)
j jn
1
h(n) = H(e )e d
2

| |
j jn
j -j
j
c
c
1
h(n) = H(e )e d
2
e =e (passband)
for H(z) =H(e )
0(stopband)
h(n)isreplacedbyh(n- )
forexampleh(n) ,for lowpass type,inabovetablebecomes:

(n=)

h(n) =
sin (n - )
(
(n-)

`
)

-M (n- ) M)
here is the phase delay or group delay of the system i.e
( )
d d( )
phase delay
group delay
d d






`



)

= = =

= = =
Example 5
Calculate the filter coefficients for a 3-tap FIR low-pass filter with a cutoff
frequency of 800 Hz and a sampling rate of 8,000 Hz using the Fourier
transform method.
/sample
Plotting H(z) in MATLAB we get the following
Example 6
Calculate the filter coefficients for a 17-tap FIR low-pass filter with a cutoff
frequency of 800 Hz and a sampling rate of 8,000 Hz using the Fourier
transform method
17 tap FIR low pass coefficients are calculated and , H(z) PH(z) are plotted below
Example 7
Calculate the filter coefficients for a 5-tap FIR band-pass filter with a
lower cutoff frequency of 2,000 Hz and an upper cutoff frequency of
2,400 Hz at a sampling rate of 8,000 Hz.
On plotting H(z) with MATLAB we get
What are the problems in FIR design with Fourier Transform Method?
The pass band magnitude responses are quite below 0dB level
There are undesirable ripples in pass band as well as stop band
There are too many side lobes whose magnitudes are comparable to main lobe
which can render any filter ineffective.
All the above problems are attributed to a phenomenon called Gibbs Effect or
Gibbs Oscillations. These Oscillations occur due to the abrupt truncation of
impulse response which is an inherent problem of FIR design.
What is the Solution?
A window function, which is symmetrical and can gradually weight the designed
FIR coefficients down to zeros at both ends for the range of M n M.
Window Method
In this section, the window method (Fourier transform design with window
functions) is developed to remedy the undesirable Gibbs oscillations in the pass-
band and stop-band of the designed FIR filter. Recall that Gibbs oscillations
originate from the abrupt truncation of the infinite-length coefficient sequence.
Then it is natural to seek a window function, which is symmetrical and can
graduall y weight the designed FIR coefficients down to zeros at both ends for the
range of M n M: Appl ying the window sequence to the filter coefficients gives
Ret
Comparative shapes of Different Windows
Steps in Window Design
Example 8
Design a 5-tap FIR band reject filter with a lower cutoff frequency of 2,000 Hz, an
upper cutoff frequency of 2,400 Hz, and a sampling rate of 8,000 Hz using the
Hamming window method.
Example 8.1
A low pass filter is to be designed with following desired frequency response
j -j2
j
e =e (- /4 /4)
for H(z) =H(e )
0 ( /4 )

`


)
Determine the filter coefficients h(n) if window function is defined as
1 (0 n 4)
(n) =
0 otherwise



`
)
( )
/4
j jn -j2 jn
/4
Either by evaluating the following integral or from the tables
1 1
h(n) = H(e )e d e e d
2 2
/4
1
= (n=2)
4
h(n) =
(n- 2)
sin
4
( 2)
(n- 2)
After cal
n



` (
(



)

w
4
j -jn
w
n=0
j -j2
cultaion of h(n) =h(n). (n) from above,
the frequency response is calculted using following expression
H(e ) = h(n) .e
after evaluation
1 2 1
H(e ) =e cos cos2
4



| |
+ +
|
|
\ .

Example 9
Design a low-pass FIR filter with 25 taps using firwd. The cutoff frequency of
the filter is 2,000 Hz, assuming a sampling frequency of 8,000 Hz. Show
comparative frequency and phase responses of the filter using rectangular,
Hamming, Hanning and Blackman Window functions
With a given sampling rate of 8,000 Hz, the normalized cutoff frequency
can be found as
Now we are ready to design FIR filters via the MATLAB program-firwd. The program,
firwd(N,Ftype,WnL,WnH,Wtype), has five input parameters, which are described as follows:
N is the number of specified filter coefficients (the number of filter taps).
Ftype denotes the filter type, that is, input 1 for the low-pass filter design, input 2 for
the high-pass filter design, input 3 for the band-pass filter design, and input 4 for the
band reject filter design.
WnL and WnH are the lower and upper cutoff frequency inputs, respectivel y. Note that
WnH = 0 when specifying WnL for the low-pass filter design, while WnL = 0 when specifying
WnH for the high-pass filter design.
Wtype specifies the window data sequence to be used in the design, that is, input 1 for
the rectangular window, input 2 for the triangular window, input 3 for the Hanning
window, input 4 for the Hamming window, and input 5 for the Blackman
window.
Result ,after execution of code for example 9 shows the following output
For a commercial design certain empirical results are necessary which are
tabulated below.
As a Thumb rule:
Example 10
Design a band-pass FIR filter with the following specifications:
1)Lower stop-band = 0500 Hz. 2)Passband = 1,6002,300 Hz. 3)Upper stop-band =
3,5004,000 Hz. 4)Stopband attenuation = 50 dB. 5)Passband ripple=0.05 dB
6)Sampling rate = 8,000 Hz
MATLAB program gives the folloing output
Kaiser Window
So far choice of the window function and the value of M are the only two freedoms
that we had for controlling the transition bandwidth , but the minimum stop-
band attenuation depends only on the window function we choose, and not the
value of M. Kaiser window function provide control over both s and the width of
the transition bandwidth . Additional parameters and , provide this
additional control. The Kaiser window is defined by
where I
0
{} is the modified zero-order Bessel function. It is a power series of the
form
We compute the values of the Kaiser window function in three steps as follows:
The parameter required to achieve the desired attenuation
s
= 20 log10(
s
)
in the stop-band is calculated from the following empirical formula derived by
Kaiser (the ripple in the pass-band is nearly the same as
s
):
Next the order of the filter N (=2M) is estimated from another empirical formula
derived by Kaiser:
The third step is to compute I
0
{x}. In practice, adding a finite number of terms,
say, 20 terms of the infinite series, gives a sufficiently accurate value for I
0
{x}.
%Design of the LP Filter using the Kaiser window:
%The length of Kaiser window must be one higher than the
% order(N=45) of the FIR filter
%obtained from the function Kaiserord
b=fir1(45, 0.35, kaiser(46, 3.3953)); [h,w]=freqz(b,1,256);
Hdb=20*log10(abs(h)); plot(w/pi,H3db);
title('Magnitude of LP with N=45 and Kaiser window')
ylabel('Magnitude in dB')
xlabel('Normalized frequency')
Example 10.1:
Design an FIR low Pass Filter using Kaiser window with order of the filter N=45
with cutoff frequency c=0.35 radians/sample;=3.3953
Optimal Filter Design
The Optimal Filter design implements Parks-McClellan algorithm. This is based
on minimizing the maximum approximation error in a Chebyshev pol ynomial.
Given an ideal frequency response H
d
(e
jT
), the approximation error E() is
defined as
where H(e
jT
) is the frequency response of the linear phase FIR filter to be
designed, and W() is the weight function for emphasizing certain frequency
bands over others during the optimization process. This process is designed to
minimize the error shown above. The figure below further clarifies the concept
and shows the different notation used in the design process
Magnitude Response of a Practical(Chebyshev)
Low-pass and ideal Low pass compared
Error between ideal and practical Response.
Weighted error is also shown
Example 10.2.
Design a low-pass filter with the following specifications:
DSP system sampling rate = 8,000 Hz; Pass-band = 0800 Hz; Stop-band =1,000
4,000 Hz; Pass-band ripple = 1 dB; Stop-band attenuation = 40 dB; Filter order =53
Then, applying Equation stated above gives
Apart from the plot the filter coefficients thus evaluated are also tabulated in the
next table. The magnitude and phase responses are also plotted certainl y the filter
response conforms with the optimization requirements.
The Matlab program for example 10.2 is written below;
FIR filter coefficients in Example 10.2
Frequency Sampling Method
1.In this method desired magnitudes of the frequency response is directl y
mentioned at frequency points determined from no of taps required in the
design.
2.To the directl y specified magnitudes in frequency domain IDFT is applied to get
the corresponding impulse response.
3.The impulse response provides the required coefficients of the transfer
functions viz. b
0
,b
1
..b
N-1
4 The transfer function is finally plotted against frequency
b
0
,b
1
..b
N-1
H(z) = b
0
+b
1
z
-1
+..b
N-1
z
-(N-1)
Designed Filter
Ideal Characteristics
Sampled magnitudes specified
from no of taps
Finite Impulse
Response
IDFT
Ret
The Procedure is summarized below
1. Given the filter length of 2M + 1, specify the magnitude frequency response for
the normalized frequency range from 0 to :
2. Calculate FIR filter coefficients:
3. Use the symmetry (linear phase requirement) to determine the rest of the
coefficients
4. Obtain the transfer function coefficients viz. b
0
,b
1
..b
N-1
from impulse response
and complete the design
Example 11
Design a linear phase low-pass FIR filter with 7 taps and a cutoff frequency of V
c
=
0.3 radian/sample using the frequency sampling method.
Gibbs Oscillations introduces ripples
Example 12
Design a linear phase low-pass FIR filter with 25 coefficients using the frequency
sampling method. Let the cutoff frequency be 2,000 Hz and assume a sampling
frequency of 8,000 Hz
The magnitude frequency response plotted using the dash-dotted line is
displayed in the upcoming figure, where it is observed that oscillations (shown
as the dash-dotted line) occur in the pass-band and stop-band of the designed
FIR filter. This is due to the abrupt change of the specification in the transition
band (between the pass-band and the stop-band). To reduce this ripple effect,
the modified specification with a smooth transition band, Hk, k = 0, 1, . . . , 13, is
used:
To facilitate easy computation another MATLAB function firfs is written for
frequency sampling method design. Following are the specifications
We will use the firfs function to design the filter of example 12. here the program
s written which evaluates the design with an abrupt magnitude specification and
another with smooth magnitude specifications so that Gibb's phenomenon can be
easily verified
Graph obtained from MATLAB program is given below
FILTER REALIZATION
Direct-Form I Realization
As we know, a digital filter transfer function, H(z), is given by
Let x(n) and y(n) be the digital filter input and output, respectively. We can express
the relationship in z-transform domain as
Y(z) = H(z)X(z)
where X(z) and Y(z) are the z-transforms of x(n) and y(n), respectively. If we
Substitute above Equation into H(z) in present equation, we have
Taking inverse Z transforms
This difference equation thus can be implemented by a direct-form I realization
shown in Figure,(A) part .(B) part illustrates the realization of the second-order IIR
filter (M = N = 2). Note that the notation used in Figures,(C) part
Direct-Form II Realization
Considering Equations in preceding paragraph with N = M, we can express
Where
Then we get
The difference equations are thus:
This difference equation thus can be implemented by a direct-form II realization
shown in Figure,(A) part .(B) part illustrates the realization of the second-order IIR
filter (M = N = 2).
Cascade (Series) Realization
An alternate way to filter realization is to cascade the factorized H(z) in the
following form:
H(z) = H
1
(z).H
2
(z)H
k
(z)
where H
k
(z) is chosen to be the first- or second-order transfer function (section),
which is defined by
For Example:
Parallel Realization
Now we convert H(z) into the following form:
OR
Example -13
Given a second-order transfer function:
Perform the filter realizations and write the difference equations using the
following realizations:
1. direct form I and direct form II
2. cascade form via the first-order sections
3. parallel form via the first-order sections.
Direct form I
Direct form I
The difference equations for the direct-form II realization are expressed as
To achieve the cascade (series) form realization, we factor H(z) into two first-order
sections to yield
Cascade Form
In order to yield the parallel form of realization, we need to make use of the partial
fraction expansion, and will first let
Using Direct form II to generate difference equations for each section:
Parallel Form
Example 14:
Use MATLAB to realize the following transfer function in Direct Form-II
Direct Form-II realization of H(z) using MATLAB Simulink
Input & Output Signals of the System from Scope
MULTI-RATE
DIGITAL SIGNAL PROCESSING
MULTI-RATE DSP
In many areas of digital signal processing (DSP) applicationssuch as
communications, speech, and audio processingrising or lowering of a sampling
rate is required. The principle that deals with changing the sampling rate belongs
essentiall y to multirate signal processing (Ifeachor and Jervis, 2002; Porat,1997;
Proakis and Manolakis, 1996; Sorensen and Chen, 1997). As an introduction, we
will focus on sampling rate conversion; that is, sampling rate reduction or
increase.
The process of reducing a sampling rate by an integer factor is referred to as
down sampling of a data sequence .We also refer to down sampling as
decimation(not taking one of ten). The term decimation used for the down
sampling process has been accepted and used in many textbooks and fields.
Down sampling a data sequence x(n) is usuall y done by an integer factor of
D(decimation),Similarl y increasing the sampling rate is up sampling or
interpolation of x(n) by a integer factor I(interpolation)
Linear Filter characteristics
Sampling rate of a signal can be changed using the above linear filter
-j j
e =e
i

i
h(n- )
j jn
j -j
j
1
h(n) = H(e )e d
2
e =e (passband)
for H(z) =H(e )
0(stopband)
h(n)isreplacedbyh(n- )

`
)

Decimation by a factor D
The effect on spectrum before and after decimation
Interpolation by a factor I
Signal Flow Graphs and Block diagram Representation
D
D D
D
I
I I
I

Z
-1
x(n) y(n)
x(n)
x(n)
x(n)
x(n)
x(n)
x(n)
x(n)
y(n)
y(n)
y(n)
y(n)
y(n)
y(n)
y(n)
Z
-1
Z
-1
Z
-1
Z
-D
Z
-1/D
Z
-L
Z
-1/L
I D=I
I
D

x(n) y(n)
x(n)
x(n)
x(n)
x(n)
x(n)
y(n)
y(n)
y(n)
y(n)
y(n)
D
x(n)
y(n)
I=D
s(n)
1 n= 0M,2M
0 otherwise
D
b
D
a

D= D
a
.D
b
y(n)
I
b
I
a

I= I
a
.I
b
x(n)
Multistage Interpolators
Multistage Decimators
Multistage Implementations
Ripple and FIR filter length(M) relation
Polyphase Decomposition of Filter Structures
{ }

-n -1 -2 -3
n=0
-M -2M -3M
-1 -M -2M -3M
-2 -M
H(z)= h(n)z =h(0)+h(1)z +h(2)z +h(3)z +....
theabove expressioncan be decomposed into
H(z)=h(0)+h(M)z +h(2M)z +h(3M)z +....
+z h(1)+h(M+1)z +h(2M+1)z +h(3M+1)z +....
+z h(2)+h(M+2)z +
{ }
{ }


-2M -3M
-(M-1) -M -2M
M-1 M-1
-(mM+K) -k -mM
k=0 m=0 k=0 m=0
M -1 M -2 M
o 1 2
h(2M+2)z +h(3M+2)z +....
+z h(M-1)+h(2M-1)z +h(3M-1)z +h(4M-1)+...
condensing the above equation into
H(z)= h(mM+k)z = z h(mM+k)z
=E (z )+z E (z )+z E (z )+..
(
(
(
(
(

(
(
(
(

-(M-1) M
(M-1)
M
i
M
o
M
1
-1 -(M-1)
M
(M-1)
.+z E (z )
Where:E (z )=H(z) fork=i =0,1,2....M-1
matrixrepresentation
E (z )
E (z )
H(z)= 1,z ,...z .
.
E (z )
Direct form
Polyphase form
Structural Block Representation
Fold Direct form
3 Fold Polyphase form
Structure Comparison
THIS ENDS THE STUDY
ON DIGITAL FILTER
DESIGN
Attenuation rate
This equation of straight line with slope -20kdB/decade
RET

Anda mungkin juga menyukai