# Is there a relatively easy way to detect likely real-time peaks in discrete-time data?

Let's say I have a set of data over time, t:

[0, 4, 6, 7, 7, 6, 4, 0]


It seems likely that this data would peak at t=3.5.

Is there a well-known algorithm for calculating this sort of peak?

• hey chaimp, i go to your website chaimpeck.com and it says "Malware detected". that's not very friendly. Nov 29 '15 at 19:57
• I have an old version of wordpress that I haven't updated in a while. That is probably why. I need to update that. Thanks for the heads-up Nov 29 '15 at 20:18
• what is the step size? Jan 19 '16 at 21:49

• i'd use a quadratic. it's unlikely that you will have two adjacent samples at a peak that are precisely the same value (and even if you do, the quadratic interpolation still works fine). so pick the discrete peak $x[n]$ and the two samples adjacent to it: the quadratic estimation for the peak is at: $$p = n + \frac12 \frac{x[n+1]-x[n-1]}{2x[n]-x[n+1]-x[n-1]}$$ just to be clear: $x[n] \ge x[n-1]$ and $x[n] \ge x[n+1]$ so $n-\frac12 \le p \le n+\frac12$ . Nov 29 '15 at 18:06