# How do I estimate the derivative of the current position, when I have only values from past to present?

If I have a discrete real-time signal $x[n]$, with its latest value $x[i]$ and all its past values $x[i-t]$, how can I estimate the derivative at $x[i]$?

• One possibility might be fitting a smoothed (overdetermined) polynomial regression using several earlier points, and using the derivative of that polynomial as an estimate. – hotpaw2 Feb 24 '14 at 15:36
• What kind of a signal are you working with? A little more information might help. – Amal Mar 23 '17 at 18:16

## 2 Answers

Is the derivative between x[n] and x[n-1] useful enough, hence x'[n] = x[n] - x[n-1] ? Or do you need a better estimate?

• No, not useful enough, because in the next step I would like to do a derivative of the derivative and then the mistake adds up. Also the data is really "jumpy". Sometimes nothing happens and then there's a jump every now and then. So I always smooth the latest 4 values. – JustGoscha Feb 24 '14 at 11:17

A reasonable solution in this case would be to do a curve fit and then establish an estimate of the derivative using the "smoothed" solution, which would help eliminate your noise issues.