Problems with a Band Pass Filter

8 次查看(过去 30 天)
David Jones
David Jones 2020-11-18
Hi
I am having a problem with bandpass filtering can somebody please assist me.
Sampling Rate 50
Number samples 3000
Sig Gen 0.2 Hertz
Amplitude 100mV
Filter
function y = doFilter(x)
%DOFILTER Filters input x and returns output y.
% MATLAB Code
% Generated by MATLAB(R) 9.8 and DSP System Toolbox 9.10.
% Generated on: 18-Nov-2020 10:12:16
persistent Hd;
if isempty(Hd)
Fstop1 = 0.05; % First Stopband Frequency
Fpass1 = 0.15; % First Passband Frequency
Fpass2 = 0.35; % Second Passband Frequency
Fstop2 = 0.45; % Second Stopband Frequency
Astop1 = 60; % First Stopband Attenuation (dB)
Apass = 1; % Passband Ripple (dB)
Astop2 = 60; % Second Stopband Attenuation (dB)
Fs = 50; % Sampling Frequency
h = fdesign.bandpass('fst1,fp1,fp2,fst2,ast1,ap,ast2', Fstop1, Fpass1, ...
Fpass2, Fstop2, Astop1, Apass, Astop2, Fs);
Hd = design(h, 'butter', ...
'MatchExactly', 'stopband', ...
'SOSScaleNorm', 'Linf');
set(Hd,'PersistentMemory',true);
end
y = filter(Hd,x);
I have attached a jpeg of my results from Matlab. The first trace is the signal after being sampled, the second is the magnitude fft, and the last trace is the filter results but as you can see I have a strange wobble just after the star and when it recovers the amplitude varies. Can you please tell me where I am going wrong.
Thank you
David

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Filter Design 的更多信息

标签

产品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by