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

    %% Quadrature Mirror Filter Bank
% The quadrature mirror filter bank (QMF) contains an analysis filter bank 
% section and a synthesis filter bank section. |dsp.Channelizer| implements 
% the analysis filter bank. |dsp.ChannelSynthesizer| implements the 
% synthesis filter bank using the efficient polyphase implementation that  
% is based on a prototype lowpass filter.

%% Initialization
% Initialize the |dsp.Channelizer| and |dsp.ChannelSynthesizer| System
% objects. Each object is set up with 8 frequency bands, 8 polyphase 
% branches in each filter, 12 coefficients per polyphase branch, and a 
% stopband attenuation of 140 dB. 
% Use a sine wave with multiple frequencies as the input signal. View the 
% input spectrum and the output spectrum using a spectrum analyzer.

offsets = [-40,-30,-20,10,15,25,35,-15];
sinewave = dsp.SineWave('ComplexOutput',true,'Frequency',...
    offsets+(-375:125:500),'SamplesPerFrame',800);

channelizer = dsp.Channelizer('StopbandAttenuation',140);
synthesizer = dsp.ChannelSynthesizer('StopbandAttenuation',140);
spectrumAnalyzer =  dsp.SpectrumAnalyzer('ShowLegend',true,'NumInputPorts',...
    2,'ChannelNames',{'Input','Output'},'Title','Input and Output of QMF');

%% Streaming 
% Use the channelizer to split the broadband input signal into multiple 
% narrow bands. Then pass the multiple narrowband signals into the 
% synthesizer, which merges these signals to form the broadband signal.
% Compare the spectra of the input and output signals.

for i = 1:5000
    x = sum(sinewave(),2);
    y = channelizer(x);
    v = synthesizer(y);
    spectrumAnalyzer(x,v);
end

%%
% The input and output spectra match very closely.