Professional Documents
Culture Documents
Filter Design With Matlab PDF
Filter Design With Matlab PDF
∑ bi s ∏ ( s – zi )
Synthesizing analog and digital filters meeting non-stand- i
ard requirements is a complex task that include non-trivial b(s)
H ( s ) = ---------- = ----------------- = g --------------------------
i i
(1)
a(s)
∏ (s – p j)
mathematics that necessitates extensive use of computer
∑ a js
j
software. One of the leading software packages for numer- j
j
ical calculations is MATLAB [1]1 from Mathworks Inc.
One of the “toolboxes” is the Signal Processing Toolbox Here we see that we can represent the transfer function
[2], which includes a set of filter design functions, includ- in two different ways, either with the coefficients of the
ing some very basic functionality for designing standard polynomials (the ai’s and bj’s) or the zeros and poles of the
filter approximations. However, most auxiliary functions polynomials (the zi’s and pj’s). These representations will
are based on the rational functions in polynomial form, have different computational properties. For higher order
which has very poor computational properties. To allevi- or narrow transition band filters the difference in accuracy
ate this shortcoming we introduce the corresponding func- is significant. The use of such high performance analog fil-
tions based on using the poles and zeros directly or on so- ters are mainly as reference filters in the design of discrete-
called transformed variables. The latter not only improves time and digital filters. Figure 1 shows the attenuation for
the numerical accuracy, but also simplifies the synthesis a 19th-order Cauer filter plotted in MATLAB using both
problem by separating the stopband and passband into two the standard function (freqs.m) and our new one based on
almost independent problems. This and other modifica- pole-zero representation. The requirement on passband
tions improves the accuracy and robustness significantly. ripple and transition band are chosen very high in order to
In this paper we investigate the suitability of using clearly show the difference in accuracy between the two
MATLAB and the Signal Processing Toolbox for filter de- approaches. The specifications for the filter is
sign and discusses possible improvements and extensions.
For simplicity we will refer to the Signal Processing Tool- A max = 0.001 dB f c = 1 Hz
box as the toolbox. Of special importance is the pole-plac- A min = 40 dB f s = 1.001 Hz
er functions that is used to synthesize filters with
equiripple or maximally flat passband and arbitrary piece- New functions for the transformations between low-
wise constant stopbands. The new functions form a filter pass and highpass, bandpass, and bandstop filters respec-
design toolbox suitable for high-performance analog and tively using the pole-zero representation have also been
digital filter synthesization problems. All functions are de- implemented.
scribed in the appendix of this paper.
1
20 3 The Pole-placer
Polynomial form
Poles and zeros
The original pole-placer algorithm was introduced by B.R.
0
Smith and G.C. Temes and is described in [5]. It uses
transformed variables [4], which separates the filter pass-
-20 band and stopband by mapping different parts of the jω -
axis in the s-plane to the real- and imaginary axis in the Z-
-40
plane. The relation between the Z-plane and the s-plane is1
2 2 2 2
2 s + ωB ωB – ω
-60
Z = ------------------ = -------------------- (2)
2 2 2 2
s + ωA ωA – ω
-80
2
components may be changed to. These values are shown
in Eq. (5).
A max = 0.1375 dB f c = 1.376 Hz
(5)
A min = 34.046 dB f s = 2.1798 Hz
D
2
−0.2
tively terminated lossless two-port, which is optimal from −5
−0.4
sensitivity point of view, the reflection zeros are the fre-
quencies at which maximum power is transferred to the −10 −0.6
load. For the equiripple and maximally flat passband filter −15
−0.8
transmission zeros found in the iterative pole-placing pro- −20 0 0.5 1 1.5
cedure. Through the Feldkellers equation [3, 6], the natu- −25
ral frequencies (the poles) can be found using the
reflection and transmission zeros and by a scaling of the −30
magnitude response. The zeros and poles can the be found −35
by transforming back to the s-plane. Also component val-
ues for ladder networks can be found directly using the Z- −40
0 1 2 3 4 5 6 7
plane variables [4]. Figure 3: Magnitude response of three third-order
This far, pole-placer functions has been developed for Chebyshev I filters with different utilization of
MATLAB for the lowpass, highpass, and bandpass filter the design margin.
cases, having either maximally flat or equiripple pass-
bands. A pole-placer algorithm for equiripple stopband fil-
ters is developed in [7]. 4.2 Pole-placer – Example 1
Since analytic expressions of the attenuation and its
This example illustrates the increased numerical accuracy
partial derivatives with respect to the attenuation pole fre-
using the transformed variable in the pole-placer and the
quencies are available, the convergence time for the im-
increased accuracy achieved by using the transformed var-
plemented pole-placing algorithms is very short.
iable. Consider the following hypothetical filter specifica-
tion1 for a lowpass Cauer filter:
4 Examples
A max = 0.00001 dB f c = 1 Hz
(6)
4.1 Example of Design Margin A min = 300 dB f s = 1.1 Hz
Assume that a lowpass Chebyshev I filter with the follow-
ing specifications is to be designed The resulting filter order is 39. Figure 4 shows the re-
sulting magnitude response calculated with the new fre-
A max = 1 dB f c = 1 Hz quency response function. A deviation from equiripple
(4) behaviour near the passband edge can be seen and is
A min = 25 dB f s = 3 Hz
caused by the clustering of poles there. An attempt to use
This filter will have an order of three. Using the stand- the freqs.m function in MATLAB Signal Processing Tool-
ard function (cheb1ap.m) with the standard arguments we box for calculating the magnitude response yields a large
will get the poles and zeros of the filter plotted with the deviation from the magnitude response shown in Fig. 4.
solid line in Fig. 3. All of the design margin is allocated to Further it can be seen that the pole-placer has sufficient
increase the stopband attenuation or decrease the transi- accuracy to synthesize as high filter orders as 39 or more.
tion band. By using the new design margin function we 1. The specification is chosen extremely stringent in order to
can get the extreme values that one of the specification clearly show the difference in numerical accuracy
3
50 0
0 -5
x 10
-20
1
-50
-40
-100 0
-150 -60
-1
-200
-80
-2 0
-250 0.2 0.4 0.6 0.8 1
-100 -0.05
-300
-0.1
-120
-350
0 0.2 0.4 0.6 0.8 1
-400 -140
0 1 2 3 4 5 6 7 8 0 1 2 3 4 5 6 7 8
Figure 4: Magnitude response of 39th-order Cauer filter Figure 6: Standard Chebyshev II lowpass filter
designed with the pole-placer. magnitude response.
-20
-10
-20
-40
-30
-60
-40 -3
x 10
2
-50 -80
0
0 -2
-60
-0.02 -4
-100
-0.04 -6
-70
-0.06 -8
4
5 Future Work Appendix - Toolbox Functions
LC filters are often used as reference filters for designing lpeq_pp.m Lowpass pole-placer, equiripple pass-
advanced active, mechanical, and digital filters. We will band.
therefore develop a synthesis toolbox for LC filters based hpeq_pp.m Highpass pole-placer, maximally fast
on the pole-placer that will exploit the superior accuracy passband.
of the transformed variable. bpeq_pp.m Bandpass pole-placer, equiripple pass-
band.
6 Conclusion lpmf_pp.m Lowpass pole-placer, maximally flat
passband.
Using the pole-zero representation is advantageous in
hpmf_pp.m Highpass pole-placer, maximally flat
most cases. We have developed MATLAB routines for
passband.
computing the frequency, magnitude, phase, and group
delay responses based on a pole-zero representation, that bpmf_pp.m Bandpass pole-placer, maximally flat
have superior numerical accuracy compared to the rou- passband.
tines supported in the MATLAB Signal Processing Tool- ppdemo.m Demonstration of the pole-placer func-
box. tions.
We have also developed a pole-placer that has superior qsgd.m Analog filter groupdelay for quadrantal-
numerical accuracy and allows the design of non-standard ly symmetrical zeros [3].
analog and digital filters with piecewise constant stopband groupdelay.m Groupdelay for general analog filters
requirements and maximally flat or equiripple passbands. (only for digital filters in the Signal
Processing Toolbox),
References buttmargin.m Butterworth design margins for a given
specification.
[1] http://www.mathworks.com/. Dec. 1998.
cheb1margin.m Chebyshev I design margins for a given
[2] Matlab, Signal Processing Toolbox User’s Guide.
specification.
The MathWorks, Inc., 1996.
[3] R.W. Daniels, Approximation Methods for Elec- cheb2margin.m Chebyshev II design margins for a given
tronic Filter Design, McGraw-Hill Book Co., New specification.
York, USA, 1974. ellipmargin.m Cauer design margins for a given speci-
[4] H.J. Orchard and G.C. Temes. “Filter Design Us- fication.
ing Transformed Variables”. IEEE Trans. Circuit margindemo.m Demonstration of possible utilization of
Theory, Vol. 15, pp. 385-408, Dec. 1968. the design margin.
[5] B.R. Smith and G.C. Temes. “An Iterative Approx- zp2hp.m Lowpass to highpass transformation for
imation Procedure for Automatic Filter Design”. poles and zeros.
IEEE Trans. Circuit Theory, Vol. 12, pp. 107-112, zp2bp.m Lowpass to bandpass transformation for
Mar. 1965. poles and zeros.
[6] A.S.Sedra and P.O. Bracket. Filter Theory and De-
zp2bs.m Lowpass to bandstop transformation for
sign: Active and Passive. Matrix Publishers, Inc.,
poles and zeros.
Portland, Oregon, USA, 1978.
[7] J. Teng, J.K. Fidler, and L. Zheng, “Pole Placement zp2frs.m Frequency response based on poles and
Algorithm for Equiripple Bandstop Filter Design”. zeros.
IEE Proc. Circuits, Devices and Syst., Vol. 141,
No. 4, Aug. 1994.