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

    %% Design Multiband Arbitrary-Magnitude Filter
% Use |fdesign.arbmag| to design a three-band filter.

% Copyright 2015 The MathWorks, Inc.


%%
% * Define the frequency vector |F| = [0 0.25 0.3 0.4 0.5 0.6 0.7 0.75
% 1.0].
% * Define the response vector |A| = [1 1 0 0 0 0 0 1 1].

N = 150;
B = 3;
F = [0 .25 .3 .4 .5 .6 .7 .75 1];
A = [1 1 0 0 0 0 0 1 1];
A1 = A(1:2);
A2 = A(3:7);
A3 = A(8:end);
F1 = F(1:2);
F2 = F(3:7);
F3 = F(8:end);
d = fdesign.arbmag('N,B,F,A',N,B,F1,A1,F2,A2,F3,A3);
Hd = design(d);
fvtool(Hd)

%%
% A response with two passbands -- one roughly between 0 and 0.25 and the
% second between 0.75 and 1 -- results from the mapping between |F| and
% |A|.