[pks, locs, widths, prominences] = findpeaks(Y)
[pks, locs, widths, prominences] = findpeaks(Y, Fs, ...)
[pks, locs, widths, prominences] = findpeaks(Y, X, ...)
| Parameter | Description |
|---|---|
| Y | vector: input signal (row or column) |
| Fs | scalar: sampling frequency (optional). If provided, peak locations are returned in time units. |
| X | vector: x-values corresponding to Y (optional). Must have same length as Y. |
| Name/Value pairs |
name/value options:
|
| Parameter | Description |
|---|---|
| pks | peak amplitudes |
| locs | peak locations (x-values or indices) |
| widths | peak widths measured at the specified WidthReference |
| prominences | prominence of each peak |
findpeaks locates local maxima (peaks) in a one-dimensional signal Y.
The algorithm detects candidate peaks, filters them by height and threshold, computes prominence and widths, enforces minimum separation, and returns the requested outputs.
When no outputs are requested, the function plots the signal and marks detected peaks.
t = 0:0.01:2*pi;
y = sin(5*t) + 0.2*randn(size(t));
findpeaks(y, t, 'MinPeakProminence', 0.3);
[pks, locs, widths, proms] = findpeaks(y, 'MinPeakHeight', 0);
| Version | Description |
|---|---|
| 1.15.0 | initial version |