4
$\begingroup$

I have a bandlimited analog signal for which I want to find the peak value in real time. The signal is sampled and processed digitally at just enough sampling rate. Since the peak of the analog signal may not be sampled exactly, taking the maximum of the digital samples would give a lower than actual value. So how do I find the peak?

Theoretically, the only way I can think of, is to upsample the signal using an ideal sinc interpolation filter to very high sampling rate, so that we obtain a sample close to the actual peak of the analog signal. Then we can just take the maximum of the digital samples. But this seems roundabout and computationally expensive. Is there is a simpler method to do this?

$\endgroup$
3
  • 4
    $\begingroup$ You could probably perform a parabolic interpolation with the 3 samples closer to the peak. It should be accurate enough if your sampling rate is high. $\endgroup$ – Ben May 3 at 13:35
  • 2
    $\begingroup$ foo.be/docs-free/Numerical_Recipe_In_C/c10-2.pdf You can use that formula, however you can simplify the formula a bit since your data is unifrmly sampled. $\endgroup$ – Ben May 3 at 13:41
  • 1
    $\begingroup$ Thanks. I'll try this out. Looks like after assuming the data is uniformly sampled, the equation simplifies to the equation @Laurent Duval has provided in the answer $\endgroup$ – Kevin Selva Prasanna May 3 at 14:18
4
$\begingroup$

You are unlikely to be able to evaluate correctly an ideal sinc interpolation filter in real-time (or even with a small time lag), since the future samples of your data are unknown. Plus, when you received your last sample $x[n]$, you generally don't know whether you are on a peak. So, it somehow boils down to

  • how real-time you want to be;
  • how fast you can estimated you are passed a peak.

There are many local possible interpolations. You can also think about fast option, and close to real-time, only require to collect the next sample $x[n+1]$, and if knowing $x[n-1]$ you consider that a peak is located between $x[n-1]$ and $x[n+1]$ (and there values are positive), you can use the standard frequency peak estimators, which only use the above three samples. For instance:

$$n_{\textrm{peak}} = n+\delta$$ with $$\delta = \frac{(x_{n+1}−x_{n-1})}{(4x_{n} − 2x_{n-1} − 2x_{n+1})}$$

A primer is provided by famous people here: Fast, Accurate Frequency Estimators, Eric Jacobsen and Peter Kootsookos, IEEE signal processing magazine, May 2007. The above equation is only one of those this paper provides.

$\endgroup$
2
  • $\begingroup$ Thanks, this is helpful. Looks like there is much more literature about finding peaks in the frequency domain rather than in time domain for some reason. The equation you have provided is doing local parabolic interpolation, right? I'll try it out $\endgroup$ – Kevin Selva Prasanna May 3 at 14:23
  • 1
    $\begingroup$ There is normally only one parabola passing exactly through 3 points. However, to take uncertainties or noise into account; there are many derived designs. For the interpolation in the time domain, with more points, there are a huge quantity of literature. One could use past peaks, have some model of peaks etc. I mentioned the frequency peaks mostly because they are fast and somehow lesser known $\endgroup$ – Laurent Duval May 3 at 14:39
0
$\begingroup$

Do you know the exact filter used to bandlimit that signal? Assuming that it is a symmetrically windowed sinc, I am not sure that you could do much better than just upsampling. Perhaps speculatively upsampling only when you find a «large» digital sample?

If the bandlimiting filter is very brickwall-y, it will contain positive and negative sections. I am not sure that a simple fitted Gaussian is going to be a good model of that.

Do you need to identify every single occurence of peaks accurately, at low complexity and low delay?

$\endgroup$
0
$\begingroup$

Assuming the signal is bandlimited to less than Nyquist, the peak between two samples can be determined from the history of prior samples. The number of samples needed is based on the actual response time of the filter or channel that the filter has passed through.

I would suggest using polyphase filters as an efficient interpolation approach that can be done in real time without increasing the sampling rate (real-time with a delay as limited by the depth of the filters). There would be N filter banks corresponding to the additional precision desired (as each filter bank results in an interpolated output including and between the original sampling rate outputs). For each of the N outputs that would be given for each original sample, the maximum value can be selected providing a maximum interpolated sample for every clock update. Further, polyphase filter banks can be relatively short, so the overall delay to the solution is also attractively small. (The number of taps needed for each filter in order to obtain an accurate result is equivalent in time span to the significant response of the channel or filter that the waveform has passed through).

Polyphase interpolators are simple to implement and highly efficient in operation. For more details on their implementation and structure see:

How to implement Polyphase filter?

$\endgroup$
2
  • 1
    $\begingroup$ Not sure, consider the case of a square wave (I'm aware that one will not be able to sample all the harmonics). The amplitude of the fundamental is 4/pi times the peak value of the square wave. So In that case, the DFT is not a good estimator. $\endgroup$ – Ben May 3 at 14:50
  • $\begingroup$ @Ben Yes! I was thinking incorrectly of just single tones but see now that wasn't the question. I updated my answer. $\endgroup$ – Dan Boschen May 7 at 4:49

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.