iphys-toolbox icon indicating copy to clipboard operation
iphys-toolbox copied to clipboard

Strange cut-off frequency

Open abc1199281 opened this issue 5 years ago • 1 comments

Thank you for sharing, it is a good open source project. However, I found that the cut-off frequency of the band pass filter seems to be inconsistent with the corresponding comment, leading to wrong cut-off frequency of the filter. This problem exist for several methods including CHROM, ICA, GREEN, POS.

image

Here is the corresponding frequency respond of the filter using filtfilt and the code how I get it.

fps = 20;
LPF = 0.5;   % low cutoff frequency (Hz)  - specified as 30 bpm (~0.667 Hz) in reference
HPF = 2.5;   % high cutoff frequency (Hz) - specified as 240 bpm (~4.0 Hz) in reference

n = -511:512;
n0 = 0;
imp = (n==n0);

NyquistF = 1/2*fps;
[B,A] = butter(3,[LPF/NyquistF HPF/NyquistF]);

imp_rep = filtfilt(B,A,double(imp));

N = 2^nextpow2(length(imp_rep));
F = fft(imp_rep,N);
freq_step = fps/N;
freq = -fps/2:freq_step:fps/2-freq_step;
freq = freq.*60; %Hz to bpm
freq = freq(N/2+1:end)';

plot(freq,abs(F(1:N/2)));
xlabel('freq(bpm)');
ylabel('mag');

image

abc1199281 avatar Mar 04 '19 04:03 abc1199281

Thanks for the comment. The reason the cut-off frequencies are different from the references is that we wanted to standardize the cut-off frequencies across all methods (since the filtering step can significantly impact the overall results and that is not really the contribution of any specific method). We left the filtering parameters used in the papers as comments so that it is clear what they were. Does that make sense?

danmcduff avatar Mar 04 '19 05:03 danmcduff