Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Low pass filter or envelope detector in Excel

  1. Jan 23, 2009 #1
    I am playing with some accelerometer data and need to filter out the noisy output.
    How do I implement a Low pass filter in excel?
    I tried avg, rolling avg. They all smooth out the data but not what I want (averaged accn is finite when it is actually zero!)
    If I can create an envelope detector in excel that would be awesome. Any help?
  2. jcsd
  3. Jan 24, 2009 #2
    Just off hand, I would square the data before averaging. Otherwise you get zeroafter subtracting gravity, ya know.
  4. Jan 24, 2009 #3
    Square the data, average it and then take the sqrt?

    Zero after subtracting gravity? how? I am measuring accn along x axis.
  5. Jan 24, 2009 #4
    Low pass filters are often defined by insertion loss in the passband, cutoff frequency and slope. Could you give us an idea of what you're looking for?

    How do you distinguish between noise and signal, by frequency?

    Perhaps you could post some sample data for and identify what signal you are trying to extract.

    "One experiment is worth a thousand expert opinioins."
  6. Jan 24, 2009 #5
    Oh dear. I think I misunderstood. You're not measuring vibration amplitude, are you?
  7. Jan 24, 2009 #6
    Phrak, no I am measuring position using accn.

    skeptic2, I've attached the excel file. A plot would give you a better idea of what I am talking. Basically the data is a bit spiky. Ideally I would prefer to use a envelope detector to get a nice acceleration curve.

    Attached Files:

  8. Jan 24, 2009 #7
    I can see why a rolling average didn't work well. The data isn't clocked in at a constant rate according to column A.
  9. Jan 26, 2009 #8


    User Avatar

    Staff: Mentor

    I did some DSP worksheets in Excel back when I was working through "Designing Digital Filters" by Williams. They really helped illustrate the DSP concepts. That was probably 10 years ago, though, so let me look back through some old backups to see if I can find them...
  10. Jan 26, 2009 #9

    An envelope detector, at least in radio, detects the peak values of the waveform. I don't think that's what you want. I took your spreadsheet and experimented with three different types of detectors but when I wanted to send it back to you I discovered there is a 100k limit on attachment size and the spreadsheet had grown to 462k. I did send you a private message about what I found.

    Briefly, I tried a rolling average but in order to avoid phase shifting the result, I averaged a few points before the current point together with a few points after. This would be the best solution IF the points were evenly spaced.

    To address the unevenly spaced points issue, I tried a Butterworth implementation. The resultant curve rises or falls exponentially the same way as a charging capacitor depending on the difference between successive points with respect to amplitude and time. Although with a single instance (pole) it had more noise than the rolling average, by stacking or using the output of one as the input of another the noise can be eliminated and the output looked as good as with the rolling average.

    I also tried Fourier filtering but that wasn't satisfactory due to the discontinuities at the beginning and end of the data series.
  11. Jan 27, 2009 #10
    your biggest problem appears to be that you can't measure a signal with resolution greater than 0.0323, and your max signal is .3871, for a ratio of ~12. most of the "noise" there is discretization noise. you really need either a bigger signal, higher resolution, or a more sensitive instrument that designed for this signal range.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook