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.
@Joel The input signal (gray, noisy curve) is a chronoamperometry that I got with some rudimentary electronics and a DAQ. It is in the time domain and it shows how current changes with time when I apply a fixed voltage on a electrochemical cell with a glucose biosensor.
The valley might be important as it varies with gloucuse concentration in most sensors, I don't really require it to be the same as the red one (a signal I got from an actual cronoamperometer/potentiostat), as long as I'm able to detect the differences in the curve at different glucose concentrations.
@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.
@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.
@lmedinar What is the sample rate for these plots? Or, stated differently, what are the time units for the X axis?
@lmedinar What are we looking at here? Is this a time-domain plot? Which signal is the filter input?