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

    %% Design of Lowpass Decimator
% This example requires the DSP System Toolbox product.
% 
% Design a 100-tap FIR lowpass decimator filter that reduces the sample rate 
% of a signal from 60 kHz to 20 kHz. The passband of the filter extends up to 
% 6 kHz. Specify a passband ripple of 0.01 dB and a stopband attenuation of 100 
% dB.

% Copyright 2015 The MathWorks, Inc.


Fs = 60e3;
N = 99;
Fpass = 6e3;
Apass = 0.01;
Astop = 100;
M = Fs/20e3;
 
filtSpecs = fdesign.decimator(M,'lowpass','N,Fp,Ap,Ast',N,Fpass,Apass,Astop,Fs);
%% 
% Design the filter and display information about it.

decimFIR = design(filtSpecs,'equiripple','SystemObject',true);
info(decimFIR)
%% 
% Visualize the magnitude response of the filter.

fvtool(decimFIR,'Fs',Fs)
%% 
%