Documentation

This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.

dsp.PeakFinder System object

Package: dsp

Determine extrema (maxima or minima) in input signal

Description

The PeakFinder object determines the extrema (maxima or minima) in the input signal.

To compute the extrema in the input signal:

  1. Define and set up your peak finder. See Construction.

  2. Call step to compute the extrema according to the properties of dsp.PeakFinder. The behavior of step is specific to each object in the toolbox.

    Note:   Starting in R2016b, instead of using the step method to perform the operation defined by the System object™, you can call the object with arguments, as if it were a function. For example, y = step(obj,x) and y = obj(x) perform equivalent operations.

Construction

H = dsp.PeakFinder returns a peak finder System object, H, that compares the current signal value to the previous and next values to determine if the current value is an extremum.

H = dsp.PeakFinder('PropertyName',PropertyValue,...) returns a peak finder System object, H, with each specified property set to the specified value.

Properties

PeakType

Looking for maxima, minima, or both

Specify whether the object is looking for maxima, minima, or both. You can set this property toMaxima, Minima, or Maxima and Minima. The default is Maxima and Minima.

PeakIndicesOutputPort

Enable output of extrema indices

Set this property to true to output the extrema indices. The default is false.

PeakValuesOutputPort

Enable output of extrema values

Set this property to true to output the extrema values. The default is false.

MaximumPeakCount

Number of extrema to look for in each input signal

The object stops searching the input signal for extrema after the maximum number of extrema has been found. The value of this property must be an integer greater than or equal to one. The default is 10.

IgnoreSmallPeaks

Enable ignoring peaks below threshold

Set this property to true if you want to eliminate the detection of peaks whose amplitudes are within a specified threshold of neighboring values. The default is false.

PeakThreshold

Threshold below which peaks are ignored

Specify the noise threshold value. This property defines the current input value as a maximum if:

  • The current input value minus the previous input value is greater than the threshold, and

  • The current input value minus next input value is greater than the threshold.

This property applies when you set the IgnoreSmallPeaks property to true. The default is 0.

 Fixed-Point Properties

Methods

cloneCreate peak finder object with same property values
getNumInputsNumber of expected inputs to the step method
getNumOutputsNumber of outputs of step method
isLockedLocked status for input attributes and nontunable properties
releaseAllow property value and input characteristics changes
stepNumber of extrema in input signal

Examples

expand all

Note: This example runs only in R2016b or later. If you are using an earlier release, replace each call to the function with the equivalent step syntax. For example, myObject(x) becomes step(myObject,x).

Determine whether each value of an input signal is local maximum or minimum.

hpeaks1 = dsp.PeakFinder;
hpeaks1.PeakIndicesOutputPort = true;
hpeaks1.PeakValuesOutputPort = true;

x1 = [9 6 10 3 4 5 0 12]';

Find the peaks of each input [prev;cur;next]: {[9;6;10],[6;10;3],...}

[cnt1, idx1, val1, pol1] = hpeaks1(x1)
cnt1 =

  uint32

   5


idx1 =

  10×1 uint32 column vector

   1
   2
   3
   5
   6
   0
   0
   0
   0
   0


val1 =

     6
    10
     3
     5
     0
     0
     0
     0
     0
     0


pol1 =

  10×1 logical array

   0
   1
   0
   1
   0
   0
   0
   0
   0
   0

Note: This example runs only in R2016b or later. If you are using an earlier release, replace each call to the function with the equivalent step syntax. For example, myObject(x) becomes step(myObject,x).

Determine peak values for a fixed-point input signal.

hpeaks2 = dsp.PeakFinder('PeakType', 'Maxima', ...
    'PeakValuesOutputPort', true, ...
    'MaximumPeakCount', 2, ...
    'IgnoreSmallPeaks', true, ...
    'PeakThreshold', 0.25, ...
    'OverflowAction', 'Saturate');
x2 = fi([-1;0.5;0],true,16,15);
[cnt2, val2] = hpeaks2(x2);

Algorithms

This object implements the algorithm, inputs, and outputs described on the Peak Finder block reference page. The object properties correspond to the block parameters.

Introduced in R2012a

Was this topic helpful?