www.gusucode.com > dsp 案例源码程序 matlab代码 > dsp/EquirippleFIRPassbandFilterExample.m

    %% Equiripple FIR Passband Filter
% Design a constrained-band FIR equiripple filter of order 100 with a
% passband of [1, 1.4] kHz. Both stopband attenuation values are
% constrained to 60 dB. The sample rate is 10 kHz.

%%

d = fdesign.bandpass('N,Fst1,Fp1,Fp2,Fst2,C',100,800,1e3,1.4e3,1.6e3,1e4);
d.Stopband1Constrained = true;
d.Astop1 = 60;
d.Stopband2Constrained = true;
d.Astop2 = 60;

Hd = design(d,'equiripple');

%%
% Visualize and measure the magnitude response of the filter.

fvtool(Hd)
measure(Hd)

%%
% The passband ripple is slightly over 2 dB. Because the design constrains
% both stopbands, you cannot constrain the passband ripple.