Low pass filter or envelope detector in Excel

Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
9 replies · 18K views
likephysics
Messages
638
Reaction score
4
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?
 
Engineering news on Phys.org
Just off hand, I would square the data before averaging. Otherwise you get zeroafter subtracting gravity, you know.
 
Square the data, average it and then take the sqrt?

Zero after subtracting gravity? how? I am measuring accn along x axis.
 
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."
 
likephysics said:
Square the data, average it and then take the sqrt?
Zero after subtracting gravity? how? I am measuring accn along x axis.

Oh dear. I think I misunderstood. You're not measuring vibration amplitude, are you?
 
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.
 

Attachments

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.
 
likephysics said:
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.

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...
 
likephysics,

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.
 
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.