# Is it necessary to downsample data for filtering of low frequencies?

My data is sampled at $f_s = 32kHz$, and for a particular analysis I'm only interested in signals with certain frequencies from $f_{highpass} = \text{0.1Hz}$ to $f_{lowpass} = \text{300 Hz}$.

When I build and apply a 4th order butterworth filter to my data I get an error and there's not much left of the signal. Here's some Matlab code:

order = 4;
[b,a] = butter(order, [0.1 300]/(32000/2), 'bandpass');
y = filtfilt(b,a,data);


The error message I get is: Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.101227e-16.

I've also tried to apply a low pass filter first, then followed by a highpass filter:

FOI = [0.1 300]
SampleRate = 32000;
[b_l,a_l] = butter(order, FOI(2)/(SampleRate/2), 'low' );
[b_h,a_h] = butter(order, FOI(1)/(SampleRate/2), 'high' );
tempData = filtfilt(b_l, a_l, data);
output = filtfilt(b_h, a_h, tempData);


But I keep getting the same result.

My questions:

• why does the filtering fail?
• why does the filtering with order 3 work but not with order 4?
• do I need to downsample the data (e.g. to 1kHz) before I can do the filtering?

EDIT: other people have hit the same problem but I'm looking for a definite answer.

EDIT2: if I change the highpass value to 1 and do the highpass filtering before the lowpass filtering, everything works. But why? Why is the cutoff of 0.1 causing problems?

• Just for fun, is your requirement for a highpass over 0.1 Hz really important here? It could totally be! But maybe not actually if you know that no significant frequency component is likely to be present. I already came through a project where people where bandpass filtering a signal with a very low highpass frequency only because it was about (with a margin) the lowest frequency their signal could be. But in the end after a Fourier analysis no lower frequency component was present so they just dropped the highpass. Just a thought! – Doombot Nov 20 '14 at 17:57