Today I spent some time studying some digital filters. Ideally, I should get a smooth signal (as the red one) while keeping the big valley.
For the three methods I tested I had to sacrifice some smoothness to keep the valley, or reduce the valley to get smoothness.
The filter applied from a sinc function window gave me the smoothest curve with a very similar valley to the mean filter window and the other one built with powers of 0.9.
I'm pretty sure there are other filters that could be applied, but I don't know if I'll have the time to try them.
@lmedinar What are we looking at here? Is this a time-domain plot? Which signal is the filter input?
@lmedinar I think you would learn a great deal by taking a quick look at the frequency spectrum of your input signal. There appears to be a noise source at a frequency around half your sample rate. You might be able to identify and remove it at the source, or remove it digitally with a notch filter.
Find a free DSP app and do a Fourier transform on the unfiltered input data to see what's going on.
@lmedinar What is the sample rate for these plots? Or, stated differently, what are the time units for the X axis?
@Joel That's a nice observation, it gave me some ideas. On the weekend I'll try to design some notch filters, but today for a quick solution I might add a little time delay between every data query on the DAQ and see what happens.