PRACTICAL MATLAB® FOR ENGINEERS PRACTICAL MATLAB

(sharon) #1

580 Practical MATLAB® Applications for Engineers


MATLAB offers a number of functions that can be used in the analysis and syn-
thesis of almost any fi lter type. The corresponding MATLAB function fi les are pre-
sented and discussed in R.6.66 through R.6.72.

R.6.66 The following function fi les can be used in the analysis and synthesis of analog
Butterworth fi lters:
a. [z, p, k] = buttap(n) returns the zeros (z), poles (p), and gain factor (k) of the normal-
ized analog Butterworth LPF transfer function of order n (with a cutoff frequency
given by wp = 1 rad/s).
b. [num, den] = butter(n, wn, ‘s’) returns the numerator and denominator polynomial
coeffi cients as row vectors in descending powers of s, of an n-order transfer func-
tion of an LPF with a cutoff frequency at wn rad/s. If wn consists of a two-element
vector [wl, wu], where wl < wu, the function returns a second-order band-pass
transfer function with drops at the wl and wu edges, and a BW given by wu − wl.
c. [num, den] = butter(n, wn, ‘fi ltertype’, ‘s’) returns an n-order HP or band-stop (BS)
fi lter of order 2n, where ‘fi ltertype’ is specifi ed as ‘high’ for an HPF, or ‘stop’ for a
BSF with the (3 dB) stop-band edges given by wn = [wl, wu], where wl < wu.
d. [n, wn] = buttord(wp, ws, Rp, Rs, ‘s’) returns the lowest-order Butterworth fi lter (n)
given by the fi lter parameters defi ned by
wp = Pass-band edge (rad/s)
ws = Stop-band edge (rad/s)
Rp = Maximum pass-band attenuation (dB)
Rs = Minimum stop-band attenuation (dB)
n = Order of the fi lter
wn = Cutoff frequency (rad/s)


R.6.67 The MATLAB function [num, den] = maxfl at (a, b, wp ) returns a Butterworth-type
fi lter with the transfer function having two orders given by a and b, where a defi nes
the degree of the num (numerator) and b the den (denominator) of the fi lter’s transfer
function instead of just using one order, and where wp is the pass-band edge that
takes a value over the range 0–1.
When the orders of the num and den are the same (a = b), the functions maxfl at
and butter return the same fi lter results.


R.6.68 For example, verify that the maxfl at and butter MATLAB functions return the same
fi lter specs for the case when a = b = 4 and wp = 0.3.


MATLAB Solution
>> [num,den] = maxflat (4,4,0.3)

num =
0.0186 0.0743 0.1114 0.0743 0.0186
den =
1.0000 -1.5704 1.2756 -0.4844 0.0762

>> [num,den] = butter(4,0.3)

num =
0.0186 0.0743 0.1114 0.0743 0.0186
den =
1.0000 -1.5704 1.2756 -0.4844 0.0762
Free download pdf