Take the 2-minute tour ×
Signal Processing Stack Exchange is a question and answer site for practitioners of the art and science of signal, image and video processing. It's 100% free, no registration required.

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.

share|improve this question

migrated from stackoverflow.com Feb 7 '13 at 18:10

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

add comment

2 Answers 2

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.

So you just divide your desired frequency (1 cycle / 48 hours) by half the sample rate ((1 sample per hour)/2), giving Wn = 0.04167 half-cycles per sample.

share|improve this answer
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.