Results 1 to 2 of 2

Math Help - Unwanted ringing in low-pass Butterworth filter.

  1. #1
    Newbie
    Joined
    Jun 2012
    From
    United States
    Posts
    5

    Question Unwanted ringing in low-pass Butterworth filter.

    I am reading some noisy data from external sensors and trying to smooth it out. I know very little about discrete filters. When looking at my data in my plotting program (kst), I applied a low-pass filter and it looked great so I tried to implement a similar filter in my own software. In the plotter program, it was described as a "zero phase low-pass filter with a butterworth amplitude response", I set order to 4 and cutoff frequency to 0.005 (as a fraction of the sample rate - my sample rate is 189 Hz so this works out to about 1Hz - my noise is roughly 6Hz).

    I searched around the internet for Butterworth filter calculators and found Butterworth / Bessel / Chebyshev Filters. I entered the following parameters:

    • Type: Butterworth
    • Order: 4
    • Sample Rate: 189
    • Corner Frequency: 1


    It generated the following coefficients and function (C++):

    Code:
    #define GAIN 1.367579855e+07
    
    float LowPass::next (float value) {
    
      xv[0] = xv[1];
      xv[1] = xv[2];
      xv[2] = xv[3];
      xv[3] = xv[4];
      xv[4] = value/GAIN;
    
      yv[0] = yv[1];
      yv[1] = yv[2];
      yv[2] = yv[3];
      yv[3] = yv[4];
      yv[4] = (xv[0] + xv[4]) + 4 * (xv[1] + xv[3]) + 6 * xv[2]
             + (-0.9167904003*yv[0]) + (3.7468029782*yv[1])
             + (-5.7431439716*yv[2]) + (3.9131302238*yv[3]);
    
      return yv[4];
    
    }

    Where xv and yv are both float[5] arrays initially filled with 0's.The results are not ideal. There is a ringing at approximately 0.91 Hz. Here is what it looks like:


    The block in the center is the original data with the filter turned off. The left and right portions are the filtered data. The filtered lines should be relatively flat, but instead there is a ~0.91Hz sine-shaped ringing. The ringing is constant amplitude, it does not seem to depend on the data and it does not diminish over time (at least as far as I can tell). Is something wrong with my filter design/implementation? Is Butterworth not the best type of filter to use here? Why does the plotter's built-in filter (not shown above) work so well when mine doesn't?

    Thanks!
    J

    Last edited by jasonc2; June 19th 2012 at 02:30 PM.
    Follow Math Help Forum on Facebook and Google+

  2. #2
    Newbie
    Joined
    Jun 2012
    From
    United States
    Posts
    5

    Re: Unwanted ringing in low-pass Butterworth filter.

    I figured it out. Seems it was just a precision problem. I switched to doubles instead of floats and the results are much smoother.
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. Replies: 1
    Last Post: November 6th 2008, 01:35 PM
  2. how to avoid unwanted page-shift?
    Posted in the LaTeX Help Forum
    Replies: 1
    Last Post: May 12th 2008, 07:59 AM
  3. Low pass filter
    Posted in the Advanced Applied Math Forum
    Replies: 17
    Last Post: February 29th 2008, 03:59 AM
  4. High Pass Filter Signal analysis! HELP HELP!!
    Posted in the Advanced Applied Math Forum
    Replies: 1
    Last Post: February 25th 2008, 04:34 AM
  5. High pass filter and signal
    Posted in the Advanced Applied Math Forum
    Replies: 2
    Last Post: September 25th 2007, 01:17 PM

Search Tags


/mathhelpforum @mathhelpforum