Trying to use a Butterworth Filter

6 views (last 30 days)
I am trying to filter out the noise from an array of wrist position data which is in degrees and was taken at 50 Hz. This is my first time using MATLAB, and this is not my area of expertise at all. I am struggling to get the results that I am looking for. I first used the fft function to get my data into the frequency domain and then used the butter function to create my filter. I wanted to perform a 6th order lowpass Butterworth Filter with a cutoff frequency of 5 Hz. I set Wn = 5/25 (cutoff frequency/nyquist frequency). I then took the fft of of my Butterworth filter and multiplied that by my data in the frequency domain. Finally, I brought my results back to the time domain by using the ifft function. My results look correct, the data follows the path of the original data but without the noise, but the values of my data are completely different. I have what looks like the correct graph, but it is shifted. I realize this changes as I change Wn, but I think I am using the correct Wn.
Any advice here would be greatly appreciated.

Accepted Answer

Rick Rosson
Rick Rosson on 11 Jan 2012
I would recommend that you stay in the time domain, and simply use the filter function. It is much simpler, and probably more accurate, than the frequency domain method that you described.
>> doc filter
HTH.
Rick
  2 Comments
Jan
Jan on 11 Jan 2012
And perhaps also: doc filtfilt
Abbey
Abbey on 11 Jan 2012
Thank you both! This worked great...when I used the filter function, I ended up with a small phase shift, so then when I used filtfilt, that was eliminated.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!