This is the first of a two-part article that focuses on a method for detecting peaks in noisy data. Part One will discuss the signal model as well as the least-means squares method of quadratic curve fitting. Part Two will discuss the detection criteria from the quadric coefficients, general applications for peak-finding as well as short videos of this particular algorithm working on synthesized test data. This sort of algorithm is not unique, and has many applications in engineering and science.

### Parabola-Fitting to Data with a Noise Component

Experimental data can be particularly noisy in some cases and peak finding therefore, must exclude any slope detection methods. Instead, a local quadratic curve fit can be used to estimate the location of a peak in noisy data. This method defines the parameters of a quadratic that best represents local data while reducing the effect of the noise contribution. Consider the case where we have data points . Assuming that is an independent variable, and has an additive noise component. This is to say, for each data point we have:

Where is a noise sample superimposed over an underlying model (with parameters ), and is the resulting noisy sample. For the purposes of peak finding, we will define as a second-order polynomial:

A system of equations summarizes the problem so that , , and can be optimally determined:

We can express this as and find either an exact solution for or an approximation for , an overdetermined system. This is to say, we wish to find . Some numeric solvers such as *Matlab* or *Octave* can provide a direct mechanism to determine an optimal in the least-squares sense (see the operator in the Matlab/Octave documentation. Use: ). In the absence of these tools, the following relationship will provide a least-squares solution:

Numerical solvers or computer libraries that have efficient matrix inversion methods can benefit from this method.

Another method for obtaining , is to attempt to minimize the squared error directly by first minimizing the error between the model and the observed data. The sum of the errors squared for a data set of data points is:

As a condition for to be minimum, the following quantities must be simultaneously minimized, one for each of the model parameters:

, ,

Evaluated explicitly, we have a system of three equations in three unknowns:

Applying Cramer’s rule after some manipulation, we can directly obtain , , and :

Where the following substitutions are to be made:

, ,

, , ,

Here, the problem of curve-fitting is reduced to an algebraic operation. This solution is important because peak-finding in noisy data employs the use of curve-fitting within a sliding window of data. The previous method used matrix operations which is computationally efficient for small windows, but yields diminishing returns as the window gets larger. Working with sums is different because the sums can be computed once. As the window shifts, the sums are adjusted for the shift. This is to say, to each sum, a value is added to compensate for the new data point considered, and a value is subtracted for the value that is now out of scope. This is a particularly interesting method to employ on microprocessor systems as the computational complexity is low, and once the sums are computed, the shift has a constant complexity (). Consider a sliding window of width within a data set of length . If we consider the first element in the window to be at position , then we can express the sums as follows:

, , ,

, , ,

Initialization occurs at where all sums are computed. For , we simply adjust the sums with respect to the shift in data:

Once obtained, can be determined. This iteration should proceed for . The minimum window size is , but should be selected to cover a range that encapsulates the minimum width of the feature we wish to detect.

In the next part of this article, the peak detection criteria will be discussed along with methods for resolving the detection of multiple peaks in close proximity. Different types of peaks will be discussed as well as possible applications for this algorithm or others of this sort.