Thursday, March 1, 2018

filters - How to find smoothed estimates of the derivative and second derivative of a signal?


I have a signal sampled at $\Delta t$: $f_i(t_i=i\Delta t)$ where $i = 0,\ldots,n-1$. I want to find the first and second derivative of the signal: $f'(t)$ and $f''(t)$.


My first thought was to estimate the derivatives by central differences:


\begin{align} f'(t_{i})&=\frac{f(t_{i+1})-f(t_{i-1})}{2\Delta t}\\ f''(t_{i})&=\frac{f(t_{i+1})-2f(t_{i})+f(t_{i-1})}{(\Delta t)^2} \end{align}



However the signal may have a lot of high frequency noise that may cause quick fluctuations in $f'$ and $f''$.


What would be the best way to find "smoothed" estimates of $f'$ and $f''$?



Answer



It probably depends more on your data. Just know, since differentiation is a linear operation, if you choose any linear filter to smooth f' and f'', it is equivalent to smoothing f using that same filter, then taking its derivatives.


Can you post some pictures or more information about the signal you want to differentiate? Probably what you're looking for is some sort of lowpass filter to smooth the signal. A couple really simple options include a single-pole recursive filter like $y(n) = a \cdot x(n) + (1-a) \cdot y(n-1)$, or a Hann filter, which is just convolving the signal with a Hann window. The Hann filter option is nice because it's linear-phase. If you know the frequency range you care about, you can just design a suitable lowpass filter in the frequency domain.


No comments:

Post a Comment

digital communications - Understanding the Matched Filter

I have a question about matched filtering. Does the matched filter maximise the SNR at the moment of decision only? As far as I understand, ...