When using the FFT notch filter to remove a given frequency (.25) and harmonics (just one bin each time), the filter removes one bin too early.
I fixed it by making the following changes to CLW_buildFFTfilter:
BEFORE
Line25: x1=fix((option.notch_fre * k+option.notch_width-xstart)/xstep)+1;
Line26: x2=fix((option.notch_fre * k+option.notch_width+option.slope_width-xstart)/xstep)+1;
Line27: v1=FFTfilter_lowpass(x1,x2,header.datasize(6));
Line28:
Line29: x2=fix((option.notch_fre * k-option.notch_width-xstart)/xstep)+1;
Line30: x1=fix((option.notch_fre * k-option.notch_width-option.slope_width-xstart)/xstep)+1;
AFTER
Line25: x1=fix((option.notch_fre * k+option.notch_width-xstart)/xstep)+2;
Line26: x2=fix((option.notch_fre * k+option.notch_width+option.slope_width-xstart)/xstep)+2;
Line27: v1=FFTfilter_lowpass(x1,x2,header.datasize(6));
Line28:
Line29: x2=fix((option.notch_frek-option.notch_width-xstart)/xstep)+2;
Line30: x1=fix((option.notch_frek-option.notch_width-option.slope_width-xstart)/xstep)+2;
I also want to point out that line 36 is problematic and leads to an error, as mentioned in previous issue reports.
I think the correct formula should be:
Line36: v((end+1)/2:end)=v(2+(end-1)/2: -1 :2);
Best,
Arthur
When using the FFT notch filter to remove a given frequency (.25) and harmonics (just one bin each time), the filter removes one bin too early.
I fixed it by making the following changes to CLW_buildFFTfilter:
BEFORE
Line25: x1=fix((option.notch_fre * k+option.notch_width-xstart)/xstep)+1;
Line26: x2=fix((option.notch_fre * k+option.notch_width+option.slope_width-xstart)/xstep)+1;
Line27: v1=FFTfilter_lowpass(x1,x2,header.datasize(6));
Line28:
Line29: x2=fix((option.notch_fre * k-option.notch_width-xstart)/xstep)+1;
Line30: x1=fix((option.notch_fre * k-option.notch_width-option.slope_width-xstart)/xstep)+1;
AFTER
Line25: x1=fix((option.notch_fre * k+option.notch_width-xstart)/xstep)+2;
Line26: x2=fix((option.notch_fre * k+option.notch_width+option.slope_width-xstart)/xstep)+2;
Line27: v1=FFTfilter_lowpass(x1,x2,header.datasize(6));
Line28:
Line29: x2=fix((option.notch_frek-option.notch_width-xstart)/xstep)+2;
Line30: x1=fix((option.notch_frek-option.notch_width-option.slope_width-xstart)/xstep)+2;
I also want to point out that line 36 is problematic and leads to an error, as mentioned in previous issue reports.
I think the correct formula should be:
Line36: v((end+1)/2:end)=v(2+(end-1)/2: -1 :2);
Best,
Arthur