www.gusucode.com > dsp 案例源码程序 matlab代码 > dsp/UseDCBlockertoRemoveDCComponentofSignalExample.m
%% Use DC Blocker to Remove DC Component of Signal % This example shows how to use the DC Blocker to remove the DC component % of a signal. %% % Load the DC Blocker example by typing |ex_dc_blocker| in the % MATLAB command prompt. %% % The spectral output from the DC Blocker is displayed in Spectrum with % Blocking, while the spectrum of the input signal is displayed in Spectrum % without Blocking. % % The two sine wave sources are set to use 1000 samples per frame because % the |Subtract mean| estimation algorithm requires a statistically significant % number of samples to calculate a valid mean. % % <<../dcblock_example_diagram.png>> %% % In the model, run the simulation. The spectrum of the input signal shows % tones at 150 Hz and 250 Hz and a significant (0 dBW) DC component. % % <<../dcblock_spectrum1.png>> %% % Using the default |IIR| setting for the DC Blocker estimation algorithm, % the tones at 150 Hz and 250 Hz are unaffected while the DC component has % been attenuated by 30 dB. % % <<../dcblock_spectrum2.png>> %% % Select the DC Blocker block by double-clicking on it and change the algorithm % type from |IIR| to |Subtract mean|. Rerun the simulation. The spectral % output from the DC Blocker shows that the |Subtract mean| estimation method % results in a DC component of less than −100 dBW. % % <<../dcblock_spectrum3.png>> %% % Try all three estimation methods. Modify the |IIR| and |FIR| parameters % to illustrate the performance of the DC Blocker using the various estimation % techniques.