Problems with a Band Pass Filter
3 views (last 30 days)
Show older comments
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 Comments
Answers (0)
See Also
Categories
Find more on Digital Filtering in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!