Discret low-pass-filter for velocity data

4 views (last 30 days)
I got a data set of velocity over time. I am trying to calculate the first and second derivative, but the data set is really noisy. How can I filter the data, so that the derivative yields realistic results.

Accepted Answer

Star Strider
Star Strider on 13 Apr 2022
That the data are ‘really noisy’ unfortunately says nothing about the nature of the noise. If the noise is band-limited (determine this by doing a Fourier transform on it), the noise can likely be eliminated with a frequency-selective filter. For broadband noise (and your signal since the nature of the noise is not described), I would use the sgolayfilt (Savitzky-Golay filter) function. I usually use an order 3 polynomial, and then experiment with the window length until I get the result that I want.
Take the derivatives of the filtered signal.
Use the gradient function to calculate the derivatives:
dydx = gradient(y) ./ gradient(x);
d2ydx2 = gradient(dydx) ./ gradient(x);
This does not require that the signals be sampled consistently, however for all other signal processing (including the fft function), they must be. Use the resample function to resample them to consistent sampling intervals if they are not. To determine sampling frequency consistency, calculate:
tsstd = std(diff(x))
where ‘x’ is the independnet variable. For a consistently-sampled signal, this should be near zero (on the order of 1E-15 or so).
.

More Answers (0)

Products


Release

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!