580
Practical MATLAB
® Applications for Engineers
MATLAB offers a number of functions that can be used in the analysis and synthesis of almost any fi lter type. The corresponding MATLAB function fi les are presented 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 normalized analog Butterworth LPF transfer function of order n (with a cutoff frequency
given by w p = 1 rad/s).
b. [num, den] = butter(n, w n , ‘s’) returns the numerator and denominator polynomial
coeffi cients as row vectors in descending powers of s, of an n-order transfer function of an LPF with a cutoff frequency at w n rad/s. If w n consists of a two-element
vector [w l , w u ], where w l < w u , the function returns a second-order band-pass
transfer function with drops at the w l and w u edges, and a BW given by w u − w l .
c. [num, den] = butter(n, w n , ‘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 w n = [w l , w u ], where w l < w u .
d. [n, w n ] = buttord(w p , w s , R p , R s , ‘s’) returns the lowest-order Butterworth fi lter (n)
given by the fi lter parameters defi ned by
w p = Pass-band edge (rad/s)
w s = Stop-band edge (rad/s)
R p = Maximum pass-band attenuation (dB)
R s = Minimum stop-band attenuation (dB)
n = Order of the fi lter
w n = Cutoff frequency (rad/s)
R.6.67 The MATLAB function [num, den] = maxfl at (a, b, w p ) 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 w p 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 w p = 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
CRC_47760_CH006.indd 580
CRC_47760_CH006.indd 580
7/23/2008 2:26:35 PM
7/23/2008 2:26:35 PM
Précédent

- 591/708

Suivant