www.gusucode.com > signal 案例源码程序 matlab代码 > signal/LowpassFIRFilterExample.m

    %% Lowpass FIR Filter
% Design a minimum-order lowpass FIR filter with normalized passband
% frequency $0.25\pi$ rad/s, stopband frequency $0.35\pi$ rad/s, passband
% ripple 0.5 dB, and stopband attenuation 65 dB. Use a Kaiser window to
% design the filter. Visualize its magnitude response. Use it to filter a
% vector of random data.

% Copyright 2015 The MathWorks, Inc.


%%

lpFilt = designfilt('lowpassfir','PassbandFrequency',0.25, ...
         'StopbandFrequency',0.35,'PassbandRipple',0.5, ...
         'StopbandAttenuation',65,'DesignMethod','kaiserwin');
fvtool(lpFilt)
dataIn = rand(1000,1);
dataOut = filter(lpFilt,dataIn);