www.gusucode.com > signal 案例源码程序 matlab代码 > signal/FilterWithPiecewiseLinearPassbandsExample.m
%% Filter with Piecewise Linear Passbands % Design a 24th-order antisymmetric filter with piecewise linear passbands. % Copyright 2015 The MathWorks, Inc. %% F = [0 0.3 0.4 0.6 0.7 0.9]; A = [0 1.0 0.0 0.0 0.5 0.5]; b = firls(24,F,A,'hilbert'); %% % Plot the desired and actual frequency responses. [H,f] = freqz(b,1,512,2); plot(f,abs(H)) hold on for i = 1:2:6, plot([F(i) F(i+1)],[A(i) A(i+1)],'r--') end legend('firls design','Ideal') grid on xlabel('Normalized Frequency (\times\pi rad/sample)') ylabel('Magnitude')