Filtros FIR - Ejemplos de Diseño
Filtros FIR - Ejemplos de Diseño
Filtros FIR - Ejemplos de Diseño
4 Examples
Previous Next
MikroElektronika
This chapter discusses various FIR filter design methods. It also provides examples
of all types of filters as well as of all methodes described in the previous chapters.
The four standard types of filters are used here:
low-pass filter;
high-pass filter;
band-pass filter; and
band-stop filter.
The design method used here is known as the window method.
The FIR filter design process can be split into several steps as described in Chapter
2.2.4 entitled Designing FIR filters using window functions. These are:
Defining filter specifications;
Specifying a window function according to the filter specifications;
Computing the filter order according to the filter specifications and specified window
function;
Computing the coefficients of the window;
Computing the ideal filter coefficients according to the filter order;
Computing the FIR filter coefficients according to the obtained window function and
ideal filter coefficients; and
If the resulting filter has too wide or too narrow transition region, it is necessary to
change the filter order. The specified filter order is increased or decreased according
to needs, and steps 4, 5 and 6 are repeated after that as many times as needed.
Depending on the window function in use, some steps will be skipped. If the filter
order is known, step 3 is skipped. If the window function to use is predetermined,
step 2 is skipped.
In every given example, the FIR filter design process will be described through these
steps in order to make it easier for you to note similarities and differencies between
various design methodes, window functions and design of various types of filters as
well.
2.4.1 Filter design using Rectangular window
2.4.1.1 Example 1
Step 1:
Type of filter low-pass filter
Filter specifications:
Filter order N=10
The values of coefficients (rounded to six digits) are obtained by combining the
values of M and c with expression for the impulse response coefficients of the
ideal low-pass filter:
Step 7:
The filter order is predetermined.
There is no need to additionally change it.
Filter realization:
Figure 2-4-1 illustrates the direct realization of designed FIR filter, whereas Figure 24-2 illustrates the optimized realization of designed FIR filter, which is based on the
fact that all FIR filter coefficients are, for the sake of linear phase characteristic,
symmetric about their middle element.
Step 1:
Type of filter high-pass filter
Filter specifications:
Filter order N=8
Sampling frequency fs=20KHz
Passband cut-off frequency fc=5KHz
Step 2:
Method filter design using rectangular window
Step 3:
Filter order is predetermined, N=8;
A total number of filter coefficients is larger by 1, i.e. N+1=9;
Coefficients have indices between 0 and 8.
Step 4:
All coefficients of the rectangular window have the same value equal to 1.
w[n] = 1 ; 0 n 8
Step 5:
The ideal high-pass filter coefficients (ideal filter impulse response) are expressed
as:
The values of coefficients (rounded to six digits) are obtained by combining the
values of M and c with expression for the impulse response coefficients of the
ideal low-pass filter:
Step 6:
The designed FIR filter coefficients are found via expression:
Step 7:
The filter order is predetermined.
There is no need to additionally change it.
Filter realization:
Figure 2-4-3 illustrates the direct realization of designed FIR filter, whereas figure 24-4 illustrates the optimized realization of designed FIR filter which is based on the
fact that all FIR filter coefficients are, for the sake of linear phase characteristic,
symmetric about their middle element.
The values of coefficients (rounded to six digits) are obtained by combining the
values of M and c1 and c2 with expression for the impulse response coefficients
of the ideal band-pass filter:
Step 7:
Filter order is predetermined.
There is no need to additionally change it.
Filter realization:
Figure 2-4-5 illustrates the direct realization of designed FIR filter, whereas figure 24-6 illustrates optimized realization of designed FIR filter which is based on the fact
that all FIR filter coefficients are, for the sake of linear phase characteristic,
symmetric about their middle element.
The values of coefficients (rounded to six digits) are obtained by combining the
values of M and c1 and c2 with expression for the impulse response coefficients
of the ideal band-stop filter:
Note that, excepting the middle element, all coefficients are the same as in the
previous example (band-pass filter with the same cut-off frequencies), but have the
opposite sign.
Step 6:
The designed FIR filter coefficients are found via expression:
Step 7:
Filter order is predetermined.
There is no need to additionally change it.
Filter realization:
Figure 2-4-7 illustrates the direct realization of designed FIR filter, whereas figure 24-8 illustrates optimized realization of designed FIR filter which is based on the fact
that all FIR filter coefficients are, for the sake of linear phase characteristic,
symmetric about their middle element.
Step 5:
The ideal low-pass filter coefficients (ideal filter impulse response) are given in the
expression below:
Since the value of M is not an integer, the middle element representing a center of
coefficients symmetry doesnt exist.
Normalized cut-off frequency c can be calculated using expression:
The values of coefficients (rounded to six digits) are obtained by combining the
values of M and c with expression for the impulse response coefficients of the
ideal low-pass filter:
Step 6:
The designed FIR filter coefficients are found via expression:
h[n] = w[n] * hd[n] ; 0 n 9
The FIR filter coefficients h[n] rounded to 6 digits are:
Step 7:
The filter order is predetermined.
There is no need to additionally change it.
Filter realization:
Figure 2-4-9 illustrates the direct realization of designed FIR filter, whereas figure 24-10 illustrates optimized realization of designed FIR filter which is based on the fact
that all FIR filter coefficients are, for the sake of linear phase characteristic,
symmetric about their middle element.
Step 5:
The ideal high-pass filter coefficients (ideal filter impulse response) are expressed
as:
The values of coefficients (rounded to six digits) are obtained by combining the
values of M and c with expression for the impulse response coefficients of the
ideal high-pass filter:
Step 6:
The designed FIR filter coefficients are found via expression:
h[n] = w[n] * hd[n] ; 0 n 8
The FIR filter coefficients h[n] rounded to 6 digits are:
Step 7:
Filter order is predetermined.
There is no need to additionally change it.
Filter realization:
Figure 2-4-11 illustrates the direct realization of designed FIR filter, whereas figure
2-4-12 illustrates optimized realization of designed FIR filter which is based on the
fact that all FIR filter coefficients are, for the sake of linear phase characteristic,
symmetric about their middle element.
Step 5:
The ideal high-pass filter coefficients (ideal filter impulse response) are expressed
as:
The values of coefficients (rounded to six digits) are obtained by combining the
values of M and c1 and c2 with expression for the impulse response coefficients
of the ideal band-pass filter:
Step 6:
The designed FIR filter coefficients are found via expression:
h[n] = w[n] * hd[n] ; 0 n 14
The FIR filter coefficients h[n] rounded to 6 digits are:
Step 7:
The filter order is predetermined.
There is no need to additionally change it.
Filter realization:
Figure 2-4-13 illustrates the direct realization of designed FIR filter, whereas figure
2-4-14 illustrates optimized realization structure of designed FIR filter which is
based on the fact that all FIR filter coefficients are, for the sake of linear phase
characteristic, symmetric about their middle element.
2.4.2.4 Example 4
Step 1:
Type of filter band-stop filter
Filter specifications:
Filter order Nf=14;
Sampling frequency fs=20KHz; and
Stopband cut-off frequencies fc1=3KHz, fc2=5.5KHz.
Step 2:
Method filter design using Bartlett window
Step 3:
Filter order is predetermined, Nf=14;
A total number of filter coefficients is larger by 1, i.e. N=Nf+1=15; and
Coefficients have indices between 0 and 14.
Step 4:
The coefficients of Bartlett window are found via expression:
Step 5:
The ideal high-pass filter coefficients (ideal filter impulse response) are expressed
as:
The values of coefficients (rounded to six digits) are obtained by combining the
values of M, c1 and c2 with expression for the impulse response coefficients of
the ideal band-stop filter:
Note that, excepting the middle element, all the coefficients are the same as in the
previous example (band-pass filter with the same cut-off frequencies), but have the
opposite sign.
Step 6:
The designed FIR filter coefficients are found via expression:
h[n] = w[n] * hd[n] ; 0 n 14
The FIR filter coefficients h[n] rounded to 6 digits are:
Step 7:
The filter order is predetermined.
There is no need to additionally change it.
Filter realization:
Figure 2-4-15 illustrates the direct realization of designed FIR filter, whereas figure
2-4-16 illustrates optimized realization of designed FIR filter which is based on the
fact that all FIR filter coefficients are, for the sake of linear phase characteristic,
symmetric about their middle element.
It is determined on purpose that FIR filters, explained in examples 3 and 4, have the
same order. The similarity between the coefficients of band-pass and band-stop FIR
filters is obvious. All coefficients of the band-stop FIR filter have the same absolute
values as the corresponding coefficients of the band-pass FIR filter. The only
difference is that they are of the opposite sign. The middle element of the band-stop
filter is defined as:
bbs = 1 bbp
where:
bbs is the middle coefficient of the band-stop filter; and
bbp is the middle coefficient of the band-pass filter.
Because of such similarity, it is easy to convert a band-pass FIR filter into a bandstop FIR filter having the same cut-off frequencies, sampling frequency and filter
order.
Besides, low-pass and high-pass FIR filters are interrelated in the same way, which
can be seen in examples describing Hann window.
2.4.3 Filter design using Hann window
2.4.3.1 Example 1
Step 1:
Type of filter low-pass filter
Filter specifications:
Filter order Nf=10;
Sampling frequency fs=20KHz; and
Passband cut-off frequency fc=2.5KHz.
Step 2:
Method filter design using Hann window
Step 3:
Filter order is predetermined, Nf=10;
A total number of filter coefficients is larger by 1, i.e. N=Nf+1=11; and
Coefficients have indices between 0 and 10.
Step 4:
The Hann window function coefficients are found via expression:
Step 5:
The ideal low-pass filter coefficients (ideal filter impulse response) are expressed as:
The values of coefficients (rounded to six digits) are obtained by combining the
values of M and c with expression for the impulse reaponse coefficients of the
ideal low-pass filter:
Step 6:
The designed FIR filter coefficients are found via expression:
h[n] = w[n] * hd[n] ; 0 n 10
The FIR filter coefficients h[n] rounded to 6 digits are:
Step 7:
The filter order is predetermined.
There is no need to additionally change it.
Filter realization:
Figure 2-4-17 illustrates the direct realization of designed FIR filter, whereas figure
2-4-18 illustrates optimized realization structure of designed FIR filter which is
based on the fact that all FIR filter coefficients are, for the sake of linear phase
characteristic, symmetric about their middle element.
Step 5:
The ideal high-pass filter coefficients (ideal filter impulse response) are expressed
as:
The values of coefficients (rounded to six digits) are obtained by combining the
values of M and c with expression for the impulse response coefficients of the
ideal high-pass filter:
Step 6:
The designed FIR filter coefficients are found via expression:
h[n] = w[n] * hd[n] ; 0 n 10
The FIR filter coefficients h[n] rounded to 6 digits are:
Step 7:
The filter order is predetermined.
There is no need to additionally change it.
Filter realization:
Figure 2-4-19 illustrates the direct realization of designed FIR filter, whereas figure
2-4-20 illustrates optimized realization structure of designed FIR filter which is
based on the fact that all FIR filter coefficients are, for the sake of linear phase
characteristic, symmetric about their middle element.
2.4.3.3 Example 3
Step 1:
Type of filter band-pass filter
Filter specifications:
Filter order Nf=14;
Sampling frequency fs=20KHz; and
Passband cut-off frequency fc1=3KHz, fc2=5.5KHz.
Step 2:
Method filter design using Hann window
Step 3:
Filter order is predtermined, Nf=14;
A total number of filter coefficients is larger by 1, i.e. N=Nf+1=15; and
Coefficients have indices between 0 and 14.
Step 4:
The Hann window function coefficients are found via expression:
Step 5:
The ideal high-pass filter coefficients (ideal filter impulse response) are expressed
as:
The values of coefficients (rounded to six digits) are obtained by combining the
values of M, c1 and c2 with expression for the impulse response coefficients of
the ideal band-pass filter:
Step 6:
The designed FIR filter coefficients are found via expression:
h[n] = w[n] * hd[n] ; 0 n 14
The FIR filter coefficients h[n] rounded to 6 digits are:
Step 7:
The filter order is predetermined.
There is no need to additionally change it.
Filter realization:
Figure 2-4-21 illustrates the direct realization of designed FIR filter, whereas figure
2-4-22 illustrates optimized realization structure of designed FIR filter which is
based on the fact that all FIR filter coefficients are, for the sake of linear phase
characteristic, symmetric about their middle element.
2.4.3.3 Example 3
Step 1:
Type of filter band-stop filter
Filter specifications:
Filter order Nf=14;
Sampling frequency fs=20KHz; and
Passband cut-off frequency fc1=3KHz, fc2=5.5KHz.
Step 2:
Method filter design using Hann window
Step 3:
Filter order is predetermined, Nf=14;
A total number of filter coefficients is larger by 1, i.e. N=Nf+1=15;
Coefficients have indices between 0 and 14.
Step 4:
The Hann window function coefficients are found via expression:
Step 5:
The ideal high-pass filter coefficients (ideal filter impulse response) are expressed
as:
The values of coefficients (rounded to six digits) are obtained by combining the
values of M, c1 and c2 with expression for the impulse response coefficients of
the ideal band-stop filter:
Note that, excepting the middle element, all coefficients are the same as in the
previous example (band-pass filter with the same cut-off frequencies), but have the
opposite sign.
Step 6:
The designed FIR filter coefficients are found via expression:
h[n]=w[n] * hd[n] ; 0 n 14
The FIR filter coefficients h[n] rounded to 6 digits are:
Step 7:
The filter order is predetermined.
There is no need to additionally change it.
Filter realization:
Figure 2-4-23 illustrates the direct realization of designed FIR filter, whereas figure
2-4-24 illustrates optimized realization structure of designed FIR filter which is
based on the fact that all FIR filter coefficients are, for the sake of linear phase
characteristic, symmetric about their middle element.
It is specified on purpose that FIR filters, explained in examples 1 and 2, have the
same order. The similarity between low-pass and high-pass FIR filter coefficients is
obvious. All coefficients of the low-pass FIR filter have the same absolute values as
the corresponding coefficients of the high-pass FIR filter. The only difference is that
they are of the opposite sign. The middle element is defined as:
blp = 1 bhp
where:
blp is the middle coefficient of a low-pass filter; and
bhp is the middle coefficient of a high-pass filter.
Because of such similarity, it is easy to convert a low-pass FIR filter into a high-pass
FIR filter having the same cut-off frequencies, sampiling frequency and filter order.
2.4.4 Filter design using Bartlett-Hanning window
2.4.4.1 Example 1
Step 1:
Type of filter low-pass filter
Filter specifications:
Filter order Nf=9;
Sampling frequency fs=22050Hz; and
Passband cut-off frequency fc=4KHz.
Step 2:
Method filter design using Bartlett-Hanning window
Step 3:
Filter order is predetermined, Nf=9;
A total number of filter coefficients is larger by 1, i.e. N=Nf+1=10; and
Coefficients have indices between 0 and 9.
Step 4:
The Bartlett-Hanning window function coefficients are found via expression:
Step 5:
The ideal low-pass filter coefficients (ideal filter impulse response) are expressed as:
The values of coefficients (rounded to six digits) are obtained by combining the
values of M and c with expression for the impulse response coefficients of the
ideal low-pass filter:
Step 6:
The designed FIR filter coefficients are found via expression:
h[n] = w[n] * hd[n] ; 0 n 9
The FIR filter coefficients h[n] rounded to 6 digits are:
Step 7:
The filter order is predetermined.
There is no need to additionally change it.
Filter realization:
Figure 2-4-25 illustrates the direct realization of designed FIR filter, whereas figure
2-4-26 illustrates optimized realization structure of designed FIR filter which is
based on the fact that all FIR filter coefficients are, for the sake of linear phase
characteristic, symmetric about their middle element.
2.4.4.2 Example 2
Step 1:
Type of filter high-pass filter
Filter specifications:
Filter order Nf=10;
Sampling frequency fs=22050Hz; and
Passband cut-off frequency fc=4KHz.
Step 2:
Method filter design using Bartlett-Hanning window
Step 3:
Filter order is predetermined, Nf=10;
A total number of filter coefficients is larger by 1, i.e. N=Nf+1=11; and
Coefficients have indices between 0 and 10.
Step 4:
The Bartlett-Hanning window function coefficients are found via expression:
Step 5:
The ideal high-pass filter coefficients (ideal filter impulse response) are expressed
as:
The values of coefficients (rounded to six digits) are obtained by combining the
values of M and c with expression for the impulse response coefficients of the
ideal high-pass filter:
Step 6:
The designed FIR filter coefficients are found via expression:
h[n] = w[n] * hd[n] ; 0 n 10
The FIR filter coefficients h[n] rounded to 6 digits are:
Step 7:
The filter order is predetermined.
There is no need to additionally change it.
Filter realization:
Figure 2-4-27 illustrates the direct realization of designed FIR filter, whereas figure
2-4-28 illustrates optimized realization structure of designed FIR filter which is
based on the fact that all FIR filter coefficients are, for the sake of linear phase
characteristic, symmetric about their middle element.
2.4.4.3 Example 3
Step 1:
Type of filter band-pass filter
Filter specifications:
Filter order Nf=12;
Sampling frequency fs=22050Hz; and
Passband cut-off frequency fc1=2KHz, fc2=5KHz.
Step 2:
Method filter design using Bartlett-Hanning window
Step 3:
Filter order is predetermined, Nf=12;
A total number of filter coefficients is larger by 1, i.e. N=Nf+1=13; and
Coefficients have indices between 0 and 12.
Step 4:
The Bartlett-Hanning window function coefficients are found via expression:
Step 5:
The ideal high-pass filter coefficients (ideal filter impulse response) are expressed
as:
The values of coefficients (rounded to six digits) are obtained by combining the
values of M, c1 and c2 with expression for the impulse response coefficients of
the ideal band-pass filter:
Step 6:
The designed FIR filter coefficients are found via expression:
h[n] = w[n] * hd[n] ; 0 n 12
The FIR filter coefficients h[n] rounded to 6 digits are:
Step 7:
The filter order is predetermined.
There is no need to additionally change it.
Filter realization:
Figure 2-4-29 illustrates the direct realization of designed FIR filter, whereas figure
2-4-30 illustrates optimized realization structure of designed FIR filter which is
based on the fact that all FIR filter coefficients are, for the sake of linear phase
characteristic, symmetric about their middle element.
Step 5:
The ideal high-pass filter coefficients (ideal filter impulse response) are expressed
as:
The values of coefficients (rounded to six digits) are obtained by combining the
values of M, c1 and c2 with expression for the impulse reaponse coefficients of
the ideal band-stop filter:
Step 6:
The designed FIR filter coefficients are found via expression:
h[n] = w[n] * hd[n] ; 0 n 12
The FIR filter coefficients h[n] rounded to 6 digits are:
Step 7:
The filter order is predetermined.
There is no need to additionally change it.
Filter realization:
Figure 2-4-31 illustrates the direct realization of designed FIR filter, whereas figure
2-4-32 illustrates optimized realization structure of designed FIR filter which is
based on the fact that all FIR filter coefficients are, for the sake of linear phase
characteristic, symmetric about their middle element.
WINDOW
FUNCTIO
N
NORMALI
ZED
LENGTH
OF THE
MAIN
LOBE FOR
N=20
TRANSITI
ON
REGION
FOR
N=20
MINIMUM
STOPBAND
ATTENUATI
ON OF
WINDOW
FUNCTION
MINIMUM
STOPBAND
ATTENUATI
ON OF
DESIGNED
FILTER
Rectangu
lar
0.1
0.041
13 dB
21 dB
Triangula
r
(Bartlett)
0.2
0.11
26 dB
26 dB
Hann
0.21
0.12
31 dB
44 dB
BartlettHanning
0.21
0.13
36 dB
39 dB
Hammin
g
0.23
0.14
41 dB
53 dB
Bohman
0.31
0.2
46 dB
51 dB
Blackma
n
0.32
0.2
58 dB
75 dB
Blackma
n-Harris
0.43
0.32
91 dB
109 dB
Using the specifications for the transition region of the required filter, it is possible
to compute cut-off frequencies:
The transition region of the filter to be designed is approximately twice that of the
filter given in the table above. For the first iteration, the filter order can be half of
that.
Filter order is Nf=10;
A total number of filter coefficients is larger by 1, i.e. N=Nf+1=11; and
Coefficients have indices between 0 and 10.
Step 4:
The Hamming window function coefficients are found via expression:
Step 5:
The ideal low-pass filter coefficients (ideal filter impulse response) are expressed as:
The values of coefficients (rounded to six digits) are obtained by combining the
values of M and c with expression for the impulse response coefficients of the
ideal low-pass filter:
Step 6:
The designed FIR filter coefficients are found via expression:
h[n] = w[n] * hd[n] ; 0 n 10
The FIR filter coefficients h[n] rounded to 6 digits are:
Step 7:
Analyse in the frequency domain is performed using the Filter Designer Tool
program.
According to the analyse performed using Filter Designer Tool, it is confirmed that
the filter order has to be incremented.
The filter order is incremented by two. The whole process of designing filter is
repeated from the step 3.
Step 3:
Filter order is Nf=12;
A total number of filter coefficients is larger by 1, i.e. N=Nf+1=13; and
Coefficients have indices between 0 and 12.
Step 4:
The Hamming window function coefficients are found via expression:
Step 5:
The ideal low-pass filter coefficients (ideal filter impulse response) are expressed as:
The values of coefficients (rounded to six digits) are obtained by combining the
values of M and c with expression for the impulse response coefficients of the
ideal low-pass filter:
Step 6:
The designed FIR filter coefficients are found via expression:
h[n] = w[n] * hd[n] ; 0 n 12
The FIR filter coefficients h[n] rounded to 6 digits are:
Step 7:
Analyse in the frequency domain is performed using the Filter Designer Tool
program.
2.4.5.2 Example 2
Step 1:
Type of filter high-pass filter
Filte specifications:
Filter order Nf=10;
Sampling frequency fs=22050Hz; and
Passband cut-off frequency fc=4KHz.
Step 2:
Method filter design using Hamming window
Step 3:
Filter order is predetermined, Nf=10;
A total number of filter coefficients is larger by 1, i.e. N=Nf+1=11; and
Coefficients have indices between 0 and 10.
Step 4:
The Hamming window function coefficients are found via expression:
\
The Hamming window function is one of rare standard windows where w[0] > 0 is in
effect.
Step 5:
The ideal high-pass filter coefficients (ideal filter impulse response) are expressed
as:
The values of coefficients (rounded to six digits) are obtained by combining the
values of M and c with expression for the impulse response coefficients of the
ideal high-pass filter:
Step 6:
The designed FIR filter coefficients are found via expression:
h[n] = w[n] * hd[n] ; 0 n 10
The FIR filter coefficients h[n] rounded to 6 digits are:
Step 7:
The filter order is predetermined.
There is no need to additionally change it.
Filter realization:
Figure 2-4-37 illustrates the direct realization of designed FIR filter, whereas figure
2-4-38 illustrates optimized realization structure of designed FIR filter which is
based on the fact that all FIR filter coefficients are, for the sake of linear phase
characteristic, symmetric about their middle element.
2.4.5.3 Example 3
Step 1:
Type of filter band-pass filter
Filte specifications:
Filter order Nf=12;
Sampling frequency fs=16KHz;
Passband cut-off frequency fc1=2KHz, fc2=5KHz.
Step 2:
Method filter design using Hamming window
Step 3:
Filter order is predetermined, Nf=12;
A total number of filter coefficients is larger by 1, i.e. N=Nf+1=13; and
Coefficients have indices between 0 and 12.
Step 4:
The Hamming window function coefficients are found via expression:
Step 5:
The ideal high-pass filter coefficients (ideal filter impulse response) are expressed
as:
The values of coefficients (rounded to six digits) are obtained by combining the
values of M, c1 and c2 with expression for the impulse response coefficients of
the ideal band-pass filter:
Step 6:
The designed FIR filter coefficients are found via expression:
h[n] = w[n] * hd[n] ; 0 n 12
The FIR filter coefficients h[n] rounded to 6 digits are:
Step 7:
The filter order is predetermined.
There is no need to additionally change it.
Filter realization:
Figure 2-4-39 illustrates the direct realization of designed FIR filter, whereas figure
2-4-40 illustrates optimized realization structure of designed FIR filter which is
based on the fact that all FIR filter coefficients are, for the sake of linear phase
characteristic, symmetric about their middle elements.
2.4.5.4 Example 4
Step 1:
Type of filter band-stop filter
Filte specifications:
Filter order Nf=12;
Sampling frequency fs=16000Hz; and
Passband cut-off frequency fc1=2KHz, fc2=6KHz.
Step 2:
Method filter design using Hamming window
Step 3:
Filter order is predetermined, Nf=12;
A total number of filter coefficients is larger by 1, i.e. N=Nf+1=13; and
Coefficients have indices between 0 and 12.
Step 4:
The Bartlett-Hanning window function coefficients are found via expression:
Step 5:
The ideal high-pass filter coefficients (ideal filter impulse response) are expressed
as:
The values of coefficients (rounded to six digits) are obtained by combining the
values of M, c1 and c2 with expression for the impulse response coefficients of
the ideal band-stop filter:
Step 6:
The designed FIR filter coefficients are found via expression:
h[n] = w[n] * hd[n] ; 0 n 12
The FIR filter coefficients h[n] rounded to 6 digits are:
Step 7:
The filter order is predetermined.
There is no need to additionally change it.
Filter realization:
Figure 2-4-41 illustrates the direct realization of designed FIR filter, whereas figure
2-4-42 illustrates optimized realization structure of designed FIR filter which is
based on the fact that all FIR filter coefficients are, for the sake of linear phase
characteristic, symmetric about their middle element.
order can also be found using Kaiser window, after which the number of iterations,
i.e. correction steps is reduced.
The forth example explains the way of designing a band-stop filter. As can be seen,
the impulse response of the resulting filter contains large number of zero values,
which results in reducing the number of multiplication operations in design process.
These zeros appear in impulse response because of the stopband width which
amounts to 0.5 = /2.
If it is possible to specify the sampling frequency from a certain frequency range,
you should tend to specify the value representing a multiple of the passband width.
The number of zeros contained in an impulse response is larger in this case,
whereas the number of multiplications, otherwise the most demanding operation in
filtering process, is less.
In the given example, only 5 multiplication operations are performed in direct
realization of a twelfth-order FIR filter, i.e. 3 multiplication operations in optimized
realization structure.
2.4.6 Filter design using Bohman window
2.4.6.1 Example 1
Step 1:
Type of filter low-pass filter
Filte specifications:
Filter order Nf=10;
Sampling frequency fs=20KHz; and
Passband cut-off frequency fc=5KHz.
Step 2:
Method filter design using Bohman window
Step 3:
Filter order is Nf=10;
A total number of filter coefficients is larger by 1, i.e. N=Nf+1=11; and
Coefficients have indices between 0 and 10.
Step 4:
The Bohman window function coefficients are found via expression:
Step 5:
The ideal low-pass filter coefficients (ideal filter impulse response) are expressed as:
The values of coefficients (rounded to six digits) are obtained by combining the
values of M and c with expression for the impulse response coefficients of the
ideal low-pass filter:
Step 6:
The designed FIR filter coefficients are found via expression:
h[n] = w[n] * hd[n] ; 0 n 10
The FIR filter coefficients h[n] rounded to 6 digits are:
Step 7:
WINDOW
FUNCTIO
N
NORMALI
ZED
LENGTH
OF THE
MAIN
LOBE FOR
N=20
TRANSITI
ON
REGION
FOR
N=20
MINIMUM
STOPBAND
ATTENUATI
ON OF
WINDOW
FUNCTION
MINIMUM
STOPBAND
ATTENUATI
ON OF
DESIGNED
FILTER
Rectangu
lar
0.1
0.041
13 dB
21 dB
Triangula
0.2
0.11
26 dB
26 dB
r
(Bartlett)
Hann
0.21
0.12
31 dB
44 dB
BartlettHanning
0.21
0.13
36 dB
39 dB
Hammin
g
0.23
0.14
41 dB
53 dB
Bohman
0.31
0.2
46 dB
51 dB
Blackma
n
0.32
0.2
58 dB
75 dB
Blackma
n-Harris
0.43
0.32
91 dB
109 dB
The transition region of the filter to be designed is somewhat wider than that of the
filter given in table 2-4-2. For the first iteration, during filter design process, the
filter order can be lower.
Unlike the low-pass FIR filter, the high-pass FIR filter must be of even order. The
same applies to band-pass and band-stop filters. It means that filter order can be
changed in odd steps. The smallest change is 2. In this case, the filter order,
comparing to that from the table (20), can be decreased by 2 for the purpose of
defining initial value.
Step 5:
The ideal high-pass filter coefficients (ideal filter impulse response) are expressed
as:
The values of coefficients (rounded to six digits) are obtained by combining the
values of M and c with expression for the impulse response coefficients of the
ideal high-pass filter:
Step 6:
The designed FIR filter coefficients are found via expression:
h[n] = w[n] * hd[n] ; 0 n 18
The FIR filter coefficients h[n] rounded to 6 digits are:
Step 7:
Analyse in the frequency domain is performed using the Filter Designer Tool
program.
Step 3:
Filter order is Nf=16;
A total number of filter coefficients is larger by 1, i.e. N=Nf+1=17; and
Coefficients have indices between 0 and 16.
Step 4:
The coefficients of Bohman window are found via expression:
Step 5:
The ideal high-pass filter coefficients (ideal filter impulse response) are expressed
as:
The values of coefficients (rounded to six digits) are obtained by combining the
values of M and c with expression for the impulse response coefficients of the
ideal high-pass filter:
Step 6:
The designed FIR filter coefficients are found via expression:
h[n] = w[n] * hd[n] ; 0 n 16
The FIR filter coefficients h[n] rounded to 6 digits are:
Step 7:
Analyse in the frequency domain is performed using the Filter Designer Tool
program.
Since the filter order must be changed by an even number, the specified value is -2.
The filter order is decreased by 2, therefore. The whole process of designing filter is
repeated from the step 3 on.
Step 3:
Filter order is predetermined, Nf=14;
A total number of filter coefficients is larger by 1, i.e. N=Nf+1=15; and
Coefficients have indices between 0 and 14.
Step 4:
The coefficients of Bohman window are found via expression:
Step 5:
The ideal high-pass filter coefficients (ideal filter impulse response) are expressed
as:
The values of coefficients (rounded to six digits) are obtained by combining the
values of M and c with expression for the impulse reaponse coefficients of the
ideal high-pass filter:
Step 6:
The designed FIR filter coefficients are found via expression:
h[n] = w[n] * hd[n] ; 0 n 14
The FIR filter coefficients h[n] rounded to 6 digits are:
Step 7:
Analyse in the frequency domain is performed using the Filter Designer Tool
program.
Filter realization:
Figure 2-4-48 illustrates the direct realization of designed FIR filter, whereas figure
2-4-49 illustrates optimized realization structure of designed FIR filter which is
based on the fact that all FIR filter coefficients are, for the sake of linear phase
characteristic, symmetric about their middle element.
2.4.6.3 Example 3
Step 1:
Type of filter band-pass filter
Filte specifications:
Filter order Nf=12;
Sampling frequency fs=44100Hz; and
Passband cut-off frequency fc1=4KHz, fc2=15025Hz.
Step 2:
Method filter design using Bohman window
Step 3:
Filter order is predetermined, Nf=12;
A total number of filter coefficients is larger by 1, i.e. N=Nf+1=13; and
Coefficients have indices between 0 and 12.
Step 4:
The coefficients of Bohman window are found via expression:
Step 5:
The ideal high-pass filter coefficients (ideal filter impulse response) are expressed
as:
The values of coefficients (rounded to six digits) are obtained by combining the
values of M, c1 and c2 with expression for the impulse response coefficients of
the ideal band-pass filter:
Step 6:
The coefficients of designed FIR filter are found via expression:
h[n] = w[n] * hd[n] ; 0 n 12
The FIR filter coefficients h[n] rounded to 6 digits are:
Step 7:
The filter order is predetermined.
There is no need to additionally change it.
Filter realization:
Figure 2-4-50 illustrates the direct realization of designed FIR filter, whereas figure
2-4-51 illustrates optimized realization structure of designed FIR filter which is
based on the fact that all FIR filter coefficients are, for the sake of linear phase
characteristic, symmetric about their middle element.
Step 5:
The ideal high-pass filter coefficients (ideal filter impulse response) are expressed
as:
The values of coefficients (rounded to six digits) are obtained by combining the
values of M, c1 and c2 with expression for the impulse response coefficients of
the ideal band-stop filter:
Step 6:
The designed FIR filter coefficients are found via expression:
h[n] = w[n] * hd[n] ; 0 n 12
The FIR filter coefficients h[n] rounded to 6 digits are:
Step 7:
The filter order is predetermined.
There is no need to additionally change it.
Filter realization:
Figure 2-4-52 illustrates the direct realization of designed FIR filter, whereas figure
2-4-53 illustrates optimized realization structure of designed FIR filter which is
based on the fact that all FIR filter coefficients are, for the sake of linear phase
characteristic, symmetric about their middle element.
Step 5:
The ideal low-pass filter coefficients (ideal filter impulse response) are expressed as:
The values of coefficients are obtained (rounded to six digits) by combining the
values of M and c with expression for the impulse response coefficients of the
ideal low-pass filter:
Step 6:
The designed FIR filter coefficients are found via expression:
h[n] = w[n] * hd[n] ; 0 n 12
The FIR filter coefficients h[n] rounded to 6 digits are:
As the sum is greater than one, it is necessary to divide all coefficients of the
impulse response by 1.000274. After division, these coefficients have the following
values:
The sum of scaled coefficients is equal to 1, which means that attenuation at 0Hz
frequency amounts to 0dB. Note that these coefficients cannot be used in designing
a FIR filter safe from filtering overflow. In order to prevent a filtering overflow from
occuring it is necessary to satisfy the condition below:
The resulting filter doesnt meet this condition. Negative coefficients in impulse
response make that both conditions cannot be met. The sum of apsolute values of
coefficients in the resulting filter is:
2.4.7.2 Example 2
Step 1:
Type of filter high-pass filter
Filte specifications:
Filter order Nf=12;
Sampling frequency fs=22050Hz;
Passband cut-off frequency fc=4KHz;
Prevention of possible filtering overflows.
Step 2:
Method filter design using Blackman window
Step 3:
Filter order is Nf=12;
A total number of filter coefficients is larger by 1, i.e. N=Nf+1=13;
Coefficients have indices between 0 and 12.
Step 4:
The coefficients of Blackman window function are found via:
Step 5:
The ideal high-pass filter coefficients (ideal filter impulse response) are expressed
as:
The values of coefficients (rounded to six digits) are obtained by combining the
values of M and c with expression for the impulse response coefficients of the
ideal high-pass filter:
Step 6:
The designed FIR filter coefficients are found via expression:
h[n] = w[n] * hd[n] ; 0 n 12
The FIR filter coefficients h[n] rounded to 6 digits are:
The sum of absolute values of the resulting FIR filter coefficients is:
The obtained coefficients must be scaled (divided) by 1.34807. After that, their
values are:
Step 7:
The filter order is predetermined.
There is no need to additionally change it.
Filter realization:
Figure 2-4-56 illustrates the direct realization of designed FIR filter, whereas figure
2-4-57 illustrates optimized realization structure of designed FIR filter which is
based on the fact that all FIR filter coefficients are, for the sake of linear phase
characteristic, symmetric about their middle element.
Step 5:
The ideal high-pass filter coefficients (ideal filter impulse response) are expressed
as:
The values of coefficients (rounded to six digits) are obtained by combining the
values of M, c1 and c2 with expression for the impulse response coefficients of
the ideal band-pass filter:
Step 6:
The designed FIR filter coefficients are found via expression:
h[n] = w[n] * hd[n] ; 0 n 12
The FIR filter coefficients h[n] rounded to 6 digits are:
The sum of absolute values of the resulting FIR filter coefficients is:
The obtained coefficients must be scaled (divided) by 1.102056. After this, their
values are:
Step 7:
The filter order is predetermined.
There is no need to additionally change it.
Filter realization:
Figure 2-4-58 illustrates the direct realization of designed FIR filter, whereas figure
2-4-59 illustrates optimized realization structure of designed FIR filter which is
based on the fact that all FIR filter coefficients are, for the sake of linear phase
characteristic, symmetric about their middle element.
2.4.7.4 Example 4
Step 1:
Type of filter band-stop filter
Filte specifications:
Filter order Nf=12;
Sampling frequency fs=16000Hz;
Passband cut-off frequencies fc1=2KHz, fc2=6KHz;
Prevention of possible filtering overflows.
Step 2:
Method filter design using Blackman window
Step 3:
Filter order is predetermined, Nf=12;
A total number of filter coefficients is larger by 1, i.e. N=Nf+1=13;
Coefficients have indices between 0 and 12.
Step 4:
The coefficients of Blackman window are found via expression:
Step 5:
The ideal high-pass filter coefficients (ideal filter impulse response) are expressed
as:
The values of coefficients (rounded to six digits) are obtained by combining the
values of M, c1 and c2 with expression for the impulse response coefficients of
the ideal band-stop filter:
Step 6:
The designed FIR filter coefficients are found via expression:
h[n] = w[n] * hd[n] ; 0 n 12
The FIR filter coefficients h[n] rounded to 6 digits are:
The sum of absolute values of the resulting FIR filter coefficients is:
The obtained coefficients must be scaled (divided) by 0.90107. After this, their
values are:
Step 7:
The filter order is predetermined.
There is no need to additionally change it.
Filter realization:
Figure 2-4-60 illustrates the direct realization of designed FIR filter, whereas figure
2-4-61 illustrates optimized realization structure of designed FIR filter which is
based on the fact that all FIR filter coefficients are, for the sake of linear phase
characteristic, symmetric about their middle element.
Step 5:
The ideal high-pass filter coefficients (ideal filter impulse response) are expressed
as:
The values of coefficients (rounded to six digits) are obtained by combining the
values of M and c with expression for the impulse response coefficients of the
ideal low-pass filter:
Step 6:
The designed FIR filter coefficients are found via expression:
h[n] = w[n] * hd[n] ; 0 n 12
The FIR filter coefficients h[n] rounded to 6 digits are:
As the sum is greater than one, it is necessary to divide all the impulse response
coefficients by 0.977947. After this, the values of these coefficients are:
The sum of scaled coefficients is equal to 1, which means that attenuation at 0Hz
frequency amounts to 0dB. Note that these coefficients cannot be used in designing
a FIR filter safe from filtering overflow. In order to prevent a filtering overflow from
occuring it is necessary to satisfy the condition below:
The resulting filter doesnt meet this condition. Negative coefficients in impulse
response indicate that both conditions cannot be met. The sum of apsolute values
of coefficients in the resulting filter is:
Step 5:
The ideal high-pass filter coefficients (ideal filter impulse response) are expressed
as:
The values of coefficients (rounded to six digits) are obtained by combining the
values of M and c with the expression for the impulse response coefficients of the
ideal high-pass filter:
Step 6:
The designed FIR filter coefficients are found via expression:
h[n] = w[n] * hd[n] ; 0 n 12
The FIR filter coefficients h[n] rounded to 6 digits are:
The sum of absolute values of the resulting FIR filter coefficients is:
The obtained coefficients must be scaled (divided) by 1.397791. After this, their
values are:
Step 7:
The filter order is predetermined.
There is no need to additionally change it.
Filter realization:
Figure 2-4-64 illustrates the direct realization of designed FIR filter, whereas figure
2-4-65 illustrates optimized realization structure of designed FIR filter which is
based on the fact that all FIR filter coefficients are, for the sake of linear phase
characteristic, symmetric about their middle element.
Step 5:
The ideal high-pass filter coefficients (ideal filter impulse response) are expressed
as:
The values of coefficients (rounded to six digits) are obtained by combining the
values of M, c1 and c2 with expression for the impulse response coefficients of
the ideal band-pass filter:
Step 6:
The designed FIR filter coefficients are found via expression:
h[n] = w[n] * hd[n] ; 0 n 12
The FIR filter coefficients h[n] rounded to 6 digits are:
Step 7:
The filter order is predetermined.
There is no need to additionally change it.
Filter reaization:
Figure 2-4-66 illustrates the direct realization of designed FIR filter, whereas figure
2-4-67 illustrates optimized realization structure of designed FIR filter which is
based on the fact that all FIR filter coefficients are, for the sake of linear phase
characteristic, symmetric about their middle element.
Step 5:
The ideal high-pass filter coefficients (ideal filter impulse response) are expressed
as:
The values of coefficients (rounded to six digits) are obtained by combining the
values of M, c1 and c2 with expression for the impulse response coefficients of
the ideal band-stop filter:
Step 6:
The designed FIR filter coefficients are found via expression:
h[n] = w[n] * hd[n] ; 0 n 20
The FIR filter coefficients h[n] rounded to 6 digits are:
The sum of absolute values of the resulting FIR filter coefficients is:
The obtained coefficients must be scaled (divided) by 1.12232. After this, their
values are:
Step 7:
The filter order is predetermined.
There is no need to additionally change it.
Filter realization:
Figure 2-4-68 illustrates the direct realization of designed FIR filter, whereas figure
2-4-69 illustrates optimized realization structure of designed FIR filter which is
based on the fact that all FIR filter coefficients are, for the sake of linear phase
characteristic, symmetric about their middle element.
This FIR filter is an excellent example showing the importance of the sampling
frequency. It is specified to give the passband amounting to 0.5. This causes most
impulse response coefficients of the resulting FIR filter to be zeros. It further makes
the filter realization structure simpler. As for optimized FIR filter design, there are
only 4 multiplications, even though the filter is of 20th order. Unfortunatelly, the
buffer length cannot be minimized. It is fixed and corresponds to the filter order.
However, it is possible to affect design complexity, whether it is hardware or
software implementation.