www.gusucode.com > dsp 案例源码程序 matlab代码 > dsp/AllpassRealizationOfAnEllipticHighpassFilterExample.m
%% Allpass Realization of an Elliptic Highpass Filter %% % *Note*: This example runs only in R2016b or later. If you are using an % earlier release, replace each call to the function with the equivalent % |step| syntax. For example, myObject(x) becomes step(myObject,x). %% % Remove a low-frequency sinusoid using an elliptic highpass filter design % implemented through a coupled allpass structure. %% % Initialize Fs = 1000; f1 = 50; f2 = 100; Fpass = 70; Apass = 1; Fstop = 60; Astop = 80; filtSpecs = fdesign.highpass(Fstop,Fpass,Astop,Apass,Fs); hHP = design(filtSpecs,'ellip','FilterStructure','cascadeallpass',... 'SystemObject',true); frameLength = 1000; nFrames = 100; hSR = dsp.SineWave('Frequency',[f1,f2],'SampleRate',Fs,... 'SamplesPerFrame',frameLength); % Input composed of two sinusoids. hplot = dsp.SpectrumAnalyzer('SampleRate',Fs,'YLimits',[-150 30],... 'PlotAsTwoSidedSpectrum',false,'ShowLegend',true,... 'FrequencyResolutionMethod', 'WindowLength','WindowLength',1000,... 'FFTLengthSource', 'Property','FFTLength', 1000,... 'Title','Original (Channel 1) Filtered (Channel 2)',... 'ChannelNames',{'Original','Filtered'}); %% % Simulate for k = 1:nFrames original = sum(hSR(),2); % Add the two sinusoids together filtered = hHP(original); hplot([original,filtered]); end