I have sampled my data at 2000 Hz and want to generate a fourth order low-pass zero-lag filter with a cut-off frequency of 150 Hz.

I have put the code below that I have created but I have the following questions. Given that I have used the filtfilt function do I need to change the number to 2 so that it is a second-order and should I also double the cut-off frequency i.e change W to 0.3 from 0.15.

rawdata = data$`Moment unfiltered`     
bf = butter(4,0.15,type = c("low"), plane = c("z"))
filtereddata = filtfilt(bf, data$`Moment unfiltered`)

1 Answer 1


do I need to change the number to “2” so that it is a second-order


and should I also double the cut-off frequency i.e change “W” to 0.3 from 0.15.


Strictly speaking, doubling up the filter will make the gain at the cutoff frequency -6dB instead of -3dB. So you have created a Linkwitz-Riley and not a Butterworth filter.

If you want a gain of exactly -3dB at 150 Hz you would need to increase the frequency slightly. You can work out the math by calculating the -1.5dB point of a Butterworth filter, but trial and error is probably quicker. 185Hz should get you fairly close.

In any case, the shape will still NOT be that of a Butterworth. Cascading two Butterworth filters does not result in another Butterworth filter. The zeros are in the right location but the poles are simply duplicated and are not Butterworth-distributed any more.

  • $\begingroup$ Ahhh I did not know that the frequency had to be slightly different, brilliant, thank you very much. I will change the order to 2 and keep as 0.15 as I am not too confident with the maths side of things. $\endgroup$ Mar 18, 2021 at 17:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.