I am trying to create a band-pass filter within the range of 0.1 Hz to 50 Hz. I am using the filterbuilder tool from MATLAB and so the code it outputs looks like this:
function y = filter050(x)
persistent Hd;
if isempty(Hd)
Fstop1 = 0.1; % First Stopband Frequency
Fpass1 = 0.15; % First Passband Frequency
Fpass2 = 45; % Second Passband Frequency
Fstop2 = 50; % Second Stopband Frequency
Astop1 = 60; % First Stopband Attenuation (dB)
Apass = 1; % Passband Ripple (dB)
Astop2 = 60; % Second Stopband Attenuation (dB)
Fs = 500; % Sampling Frequency
h = fdesign.bandpass('fst1,fp1,fp2,fst2,ast1,ap,ast2', Fstop1, Fpass1, ...
Fpass2, Fstop2, Astop1, Apass, Astop2, Fs);
Hd = design(h, 'equiripple', ...
'MinOrder', 'any');
set(Hd,'PersistentMemory',true);
end
y = filter(Hd,x);
The problem is that this runs forever. I understand that my filter will require a high number of points since it is such low frequency and with a sampling rate of 500 Hz, but I really did not want to downsample my signal... Is there any way around it?
Also, I tried downsampling to check if it would run faster, downsampled to 100 Hz and still runs forever.