Digital Filter Design Using Spreadsheets: Karim Y. Kabalan, Ali El-Hajj
Digital Filter Design Using Spreadsheets: Karim Y. Kabalan, Ali El-Hajj
Digital Filter Design Using Spreadsheets: Karim Y. Kabalan, Ali El-Hajj
Spreadsheets
KARIM Y. KABALAN, ALI EL-HAJJ
Department of Electrical and Computer Engineering, American University of Beirut, P.O. Box 11-0236, Beirut,
Lebanon
ABSTRACT: This article presents a spreadsheet approach to the design of analog and
digital Butterworth and Chebyshev filters. Corresponding analog filters are designed; then,
bilinear transformation is used to map from the s plane into the z plane. Plots of magnitude
and pole locations in the s and z planes of each filter are obtained. Although software
packages are available to solve this problem, the spreadsheet solution makes an excellent
and effective way of achieving the task in a manner that can be interpreted and thoroughly
understood. This approach is only an introduction to the subject, but the topic chosen forms
strong links with the rest of the design problems. © 1999 John Wiley & Sons, Inc. Comput Appl Eng
Educ 7: 9 –15, 1999
the students with examples and new ideas on how to use 2d 1 , 20 log10uH~jV!u , 2d 2 (2)
spreadsheets in filter design.
This article is divided into five sections. The next In addition, the bilinear transformation yields
section treats the Butterworth filter; the Chebyshev is
considered in the third section. A general conclusion
and concluding remarks are given in the final section. Vp 5
2
T S D
tan
vp
2
(3)
BUTTERWORTH FILTER Vs 5
2
T SD
tan
vs
2
(4)
5 10 d1/10 (5)
Vc
1
S D
uH~ v !u 2 5
S D2
(1)
v 2N
1
11 j
2 vs 2N
vc tan
T 2
11 5 10 d2/10 (6)
Vc
In Equation (1), v c is the cutoff frequency in rads per
second, and N is the filter order.
Equations (5) and (6) can be used to obtain the ex-
In designing a Butterworth digital filter, the pass-
pression of N. This expression is given by
band ripple d1 in decibels, the attenuation in the
stop-band d2 in decibels, the pass-band frequency v p ,
log10 @10d 2/10 2 1# 2 log10 @10d 1/10 2 1#
the stop-band frequency v s , and the sampling period
F S DG F S DG
1
N52 z (7)
T in seconds must be given. These values are stored, 2 vs 2 vp
log10 tan 2 log10 tan
respectively, in cells B4, C4, D4, E4, and F4, as T 2 T 2
shown in Figure 1. To design the filter, the following
equation must be satisfied: The corresponding spreadsheet formula is
DIGITAL FILTER DESIGN 11
1 1 22
2N
2
tan~ v p/2!
T
d 1 5 10 z log10 11 (11)
Vc
d1 5 10*LOG10(1 1 ((2/$F4*TAN(D4/2))
(12)
/C7)ˆ(2*C6))
Real s 5 V ccos
S p ~2k 1 1!
2N 1 12 D (13)
CHEBYSHEV FILTER
S D
uH~V!u 2 5 (16)
V
11« V2 2
N
Vc
V 0~x! 5 1 (17)
V 1~x! 5 x
Figure 3 Pole locations of the Butterworth filter in the z
plane. It should be noted that V c 5 V p in case of Chebyshev
filter. « and the order of the filter must be chosen so
the specifications are met exactly at the pass-band and
This program has been tested for a filter having v p the stop-band frequencies. That is,
5 0.2 p , v s 5 0.3 p , d1 5 1 dB, and d2 5 15 dB. The
order of this filter and the cutoff frequency are found 2d 1 , 20 log10uH~jV!u
to be 6 and 0.76622, respectively. The plots of the (18)
pole locations in the s plane and z plane of this filter 20 log10uH~jV!u , 2d 2
are shown in Figures 2 and 3, respectively. Figure 4
shows the magnitude of this filter as it is normalized Using the first part of Equation (18), the value of « is
to a maximum amplitude of unity. obtained using the following formula:
« 5 ~10 d1/10 2 1! 1/2 (19) the second equation of (18) must be satisfied. To
achieve this task, a table of five columns is con-
The value of « is computed and stored in Cell D7 structed. In the first column (Column H), the value of
using the following spreadsheet formula: N is introduced from 0 until a maximum value defined
usually by the user. In our case, a maximum value of
5 (10ˆ)(C4/10) 2 1)ˆ0.5 (20) 12 is considered. In the next column (Column I), the
value of V N ( x) is computed using Equation (17), and
The next step is to determine the order N of the filter the magnitude of the filter of the corresponding value
so specifications are met at the stop-band. In this case,
Figure 6 Pole locations of the Chebyshev filter in the s Figure 7 Pole locations of the Chebyshev filter in the z
plane. plane.
14 KABALAN AND EL-HAJJ
of these polynomials is obtained in Column J. Column These values are obtained and stored in Cells C8, C9,
K contains the results of the right-hand side of the and C10, respectively. The next step is to determine
second part of Equation (18) which is obtained by the location of the poles of the filter in the s plane.
replacing V with V c . This formula is found to be These locations are given by the following formula:
VNS D F
Vs
Vp
1
$ 2 @10 d2/10# 2 1
« G
1/2
(21) s 5 aV pcos$ p @~2k 1 1!/2N 1 2 #%
1
(25)
1 jbV psin$ p @~2k 1 1!/2N 1 1
2
#%
Column L is a comparative column where an IF
function is introduced. This statement compares the
elements of Columns J and K and returns an empty As for the previous case, the pole locations in the
cell if J is less than K; otherwise, it will return the z plane are obtained and placed in the table, as shown
value of N. in Figure 5.
The example used for Butterworth filter is used in
5IF(J6 . K6, H6,9999) (22) this section. The resulting filter is of order 4 with a
cutoff frequency of 0.6498. The pole locations of the
Finally, the order of the filter is obtained by sim- filter in the s plane and the z plane are shown in
plify taking the minimum value in the L column. The Figures 6 and 7, respectively. The magnitude of the
value of N is computed and stored in Cell D6 using filter is plotted in Figure 8 normalized to a maximum
the following spreadsheet formula: amplitude of unity.
5MIN(L3.L15) (23)
CONCLUSION
The poles in the s domain lie on an ellipse with minor
axis radius a*V c and major axis radius b*V c , where
Designing digital filters using spreadsheets has proved
all the advantages listed in the introduction of this
a 5 12 * ~ a 1/N 2 a 21/N! article. It is flexible in changing the specifications and
modifying the layouts, programming the formulas,
b 5 12 * ~ a 1/N 1 a 21/N! (24) and plotting output. On the other hand, the approach
followed here in designing filters can be altered and
a 5 « 21 1 ~1 1 « 22! 1/2 used to design other types of filters.
DIGITAL FILTER DESIGN 15
BIOGRAPHIES
Karim Y. Kabalan was born in Jbeil, Leb- Ali El-Hajj was born in Aramta, Lebanon, in
anon. He received the BS degree in physics 1959. He received the lisense degree in Physics
from the Lebanese University in 1979, and from the Lebanese University, Lebanon, in
the MS and PhD degrees in electrical engi- 1979; the degree of “Ingenieur” from L’Ecole
neering from Syracuse University, in 1983 Superieure d’Electricite, France, in 1981; and
and 1985, respectively. During the 1986 fall the “Docteur Ingenieur” degree from the Uni-
semester, he was a visiting assistant profes- versity of Rennes I, France, in 1983. From
sor of electrical engineering at Syracuse Uni- 1983 to 1987, he was with the Department of
versity. Currently, he is a professor of elec- Electrical Engineering at the Lebanese Univer-
trical engineering with the Department of Electrical and Computer sity. In 1987 he joined the American University of Beirut, where he is
Engineering Faculty of Engineering and Architecture, American currently a professor of electrical and computer engineering. His
University of Beirut. His research interests are numerical solution research interests are numerical solution of electromagnetic field prob-
of electromagnetic field problems and software development. lems and engineering education.