<< filtord | FOSSEE_Signal_Processing_Toolbox | fir1 >>

FOSSEE_Signal_Processing_Toolbox >> FOSSEE_Signal_Processing_Toolbox > findpeaks

# findpeaks

Find peaks in a signal.

### Syntax

    [pks, loc] = findpeaks(data)
    [pks, loc, extra] = findpeaks(data)
    [pks, loc, extra] = findpeaks(data, "PropertyName", PropertyValue)
    [pks, loc, extra] = findpeaks(data, "DoubleSided")

### Parameters

data:

  Vector. The input signal to analyze. Must be a single column vector with at least 3 elements.

pks:

  Vector. The values of the peaks in the input signal.

loc:

  Vector. The indices of the peaks in the input signal.

extra:

  Structure. Contains additional information about the peaks:

- "parabol":

  Structure containing the parabola fitted to each peak.

- "height":

  Estimated height of the peaks.

- "baseline":

  Baseline height at which the roots of the peaks were calculated.

- "roots":

  Abscissa values at which the parabola fitted to each peak realizes its width.

Property-Value Pairs:

- "MinPeakHeight":

  Minimum peak height (non-negative scalar). Default is `eps`.

- "MinPeakDistance":

  Minimum separation between peaks (positive integer). Default is 1.

- "MinPeakWidth":

  Minimum width of peaks (positive integer). Default is 1.

- "MaxPeakWidth":

  Maximum width of peaks (positive integer). Default is `Inf`.

- "DoubleSided":

  Indicates that the data contains both positive and negative values. The baseline is taken as the mean value of the data.

### Description

This function identifies peaks in the input signal `data`. Peaks are defined as local maxima for positive data or maxima/minima for double-sided data. The function supports additional options to filter peaks based on height, distance, and width.

### Examples

    // Find peaks in a simple signal:
    data = [1, 3, 2, 5, 1]
    [pks, loc] = findpeaks(data)

    // Find peaks with a minimum height:
    data = [1, 3, 2, 5, 1]
    [pks, loc] = findpeaks(data, "MinPeakHeight", 3)

    // Find peaks in double-sided data:
    data = [1, -3, 2, -5, 1]
    [pks, loc] = findpeaks(data, "DoubleSided")

Report an issue
<< filtord | FOSSEE_Signal_Processing_Toolbox | fir1 >>