I have a system where I sample some data periodically (every 10usec). The shape of the data is triangle, in other words it linearly increases and decreases in time. (Both theory and practice are in agreement, I plot the ADC output and I clearly see linear increase and decrease although there is some non-linearity but let's ignore that for the sake of discussion) However the frequency of the signal is not fixed. It may increase very fast or very slow. (narrow or wide triangle)

I am trying to locate the true peak point of the data with 500nsec accuracy, however my ADC samples every 10usec. One item on my favor is that the data values increase and decrease in sequence. I get worst case 50 samples, best case 1000 samples. (in worst case, I will have 25 samples in increasing order and 25 in decreasing order)

How can I approach this issue using DSP techniques? One idea I had was to calculate peak point from rise and fall angles. (I basically extend the left and right side of the triangle and look at where those lines cross each other). I cannot think of any other way. I welcome suggestions.

  • 2
    $\begingroup$ Simply calculating the slopes and intersection is the first thing that comes to my mind. Do you need to have high accuracy, or high precision -- ie, do you want to measure peak-to-peak accurately or instead you need to correlate each peak with some other event? $\endgroup$ Feb 1, 2012 at 13:22
  • $\begingroup$ Do you have significant noise in your measurements? $\endgroup$
    – Jason R
    Feb 1, 2012 at 14:18
  • $\begingroup$ Posting some images would be extremely helpful, too. $\endgroup$
    – Phonon
    Feb 1, 2012 at 14:37
  • $\begingroup$ @DanielRHicks I need to calculate the time of peak accurately. The amplitude of the peak is not that big of a deal. $\endgroup$
    – Frank
    Feb 2, 2012 at 0:07
  • $\begingroup$ @JasonR SNR is between 10 to 20 dB, so yes there is a lot of noise. $\endgroup$
    – Frank
    Feb 2, 2012 at 0:07

2 Answers 2


If you can reliably determine which samples are on a rising portion and which are on a falling portion, then perhaps you can do a linear regression on each (near)monotonic segment, and solve for the intersections of the computed regression lines.

If you know the non-linearity equation, then you can do a regression against that curve instead of using linear regression, and compute or numerically solve for the curve intersections, if needed.

This regression method might also help with error or robustness estimates, if needed.

  • $\begingroup$ I got a question, how about I do a curve fitting for a high order (current is 8) and calculate the peak from the polynomial. I guess this is same as what you are explaining. $\endgroup$
    – Frank
    Feb 6, 2012 at 9:11
  • $\begingroup$ @Frank : A regression-fitted high-order polynomial can produce wildly inaccurate estimates when extrapolating even a little bit past the endpoints, unless perhaps the underlying waveform is produced by a polynomial of that degree. $\endgroup$
    – hotpaw2
    Feb 6, 2012 at 20:33

In a comparable situation where I need to determine the position of the peak with high accuracy I resample the signal at 2MHz (using a sync interpolation) and then search for the highest valued sample.

  • $\begingroup$ What is the benefit of this approach? Isn't this same as slope interpolation? (As you resample, you probably use the slope to resample). I guess I don't know what sync interpolation means $\endgroup$
    – Frank
    Feb 2, 2012 at 0:08
  • $\begingroup$ It is not the same as slope interpolation because it doesn't depend on the signal being triangular. It will also work with sines etc. $\endgroup$
    – Han
    Feb 2, 2012 at 8:34
  • $\begingroup$ Sync interpolation is the technique were you replace every original sample by a sync function and calculate the interpolated samples by adding the sync function values at that sample position. (see: en.wikipedia.org/wiki/…) $\endgroup$
    – Han
    Feb 2, 2012 at 8:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.