LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

low pass filter vs. moving average

The data was obtained in every 1 s (1 Hz) and find a some periodical small peak.
Using excel, I applied the moving average of multiple stage to the data.
As you can see the peak can be removed by this simple calculation.

 

I would like to use a low pass filter to obtain the similar shape of graph for reliable analysis.
Before the shape according to 'window' parameter, I put the cutoff frequency and taps as the parameters for the first time.
However, the filtered value itself was very 'sensitive' to the change of taps.

I can guess this trouble came from raw data of dc-offset in each point.

 

The sample data was attached.
(I didn't consider some delay of filtered data due to taps.)

 

The original data was changed seriously compared to the average method.
I am afraid that the filtered data was changed  when other data was put to the code even with optimized value of taps.

My question is how to find the insensitive values of taps in fixed cutoff frequency in best way to mimic the moving average?

 

labmaster.

Download All
0 Kudos
Message 1 of 5
(6,268 Views)

I am not an expert in filtering, but I would use the butterworth filter function rather than an FIR filter.

 

For a start windowing your data will change the amplitude and is generally used when you are carrying out FFT later on to prevent the edges of your data producing high frequency spikes in your FFT.

 

It is also important to note that filters will change the phase of your data, that is why you are seeing a slight offset in the filtered data.

 

Personally, I would implement a moving average (center weighted if you are doing it after you have acquired all the data as this won't produce a phase offset) because it means I don't have to delve into the world of filters, which isn't the simplest (just me being lazy though). One day I might.

filter.png

0 Kudos
Message 2 of 5
(6,225 Views)

One cause for this 'peaks' (wave): You still have some line hum on your signal.  That mix with your sample clock and results in low frequency content.. To avoid it use an analog input filter matching the samplerate, (you know Shannon, Nyquist,... 😉 )  to make the filter smaller, you can use a samplerate of 1 kHz (and a 300Hz analog filter) and do a decimation with mean filter in software.

Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


0 Kudos
Message 3 of 5
(6,213 Views)

After some study for low pass filter (rectangle and gaussian window), I made a conclusion that the FIR "low pass filter" of LabVIEW has a bug. 

 

There is no reason to modify the DC level of the imcoming data in general processing.

 

I want somebody of NI to reply for my trouble.

 

labmaster.

0 Kudos
Message 4 of 5
(6,135 Views)

Can't help with the FIR filter design vi ...

However here are two ways to create what I think you want 😉

Rec mean.png

Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


Message 5 of 5
(6,100 Views)