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

    %% Impulse and Frequency Response of Halfband Interpolation Filter
% Create a lowpass halfband interpolation filter for upsampling data
% to 44.1 kHz. Specify a filter order of 52 and a transition width
% of 4.1 kHz.

% Copyright 2015 The MathWorks, Inc.


Fs = 44.1e3;
InputSampleRate = Fs/2;
Order = 52;
TW = 4.1e3;
filterspec = 'Filter order and transition width';

firhalfbandinterp = dsp.FIRHalfbandInterpolator(...
    'Specification',filterspec,'FilterOrder',Order,...
    'TransitionWidth',TW,'SampleRate',InputSampleRate);
%%
% Plot the impulse response. The 0th order coefficient is delayed
% 26 samples, which is equal to the group delay of the filter. This yields
% a causal halfband filter.

fvtool(firhalfbandinterp,'Analysis','Impulse');

%%
% Plot the magnitude and phase response.

fvtool(firhalfbandinterp,'Analysis','freq');