# Cut off frequency for low pass filter

Hi I am trying to use a low pass filter in Matlab. I am trying to use the simple butterworth filter.

I have defined dataset say "data". Then I created the butterworth filter as follows:

[B,A]=butter(2,0.01)


Butterworth design require the user to give N and Wn. I used N as 2 and Wn as 0.01. Here, I randomly chose the value of Wn to 0.01.

My data is a hourly data and I want to apply 48 hour low pass filter. What would be the cut off frequency in my case ?

After that I used the following code to design a filter:

filter(B,A,data)


The filtered data looks good but I want to know what cutoff frequency should I use.

Thanks.

## migrated from stackoverflow.comFeb 7 '13 at 18:10

This question came from our site for professional and enthusiast programmers.

The butter command expects a normalized frequency from 0 to 1, where 1 is the Nyquist frequency. In other words, Wn is in half-cycles per sample.
Filters are agnostic to the sampling frequency you use. What matters is the normalized cut off frequency. As a result the filter obtained from a function like butter will work for any sampling frequency. A value of 1 corresponds to half the sampling frequency.
In your case your sampling frequency is 1 hr$^{-1}$. Hence a value of 0.01 corresponds to a frequency cutoff of .01 $\times$ 0.5 = .005 hr$^{-1}$ or 200 hrs time.