Find Peak Values in a Signal
This example shows how the Peak Finder block analyzes a signal and detects peaks in the signal.
Consider the input vector [9 6 10 3 4 5 0 12]. Set the Peak Finder block parameters to the following values:
Peak type(s) to
Maxima and Minima
.Index base to
Zero
.Select Output peak indices.
Select Output peak values.
Maximum number of peaks to find to
5
.Clear Ignore peaks within threshold of neighboring values.
This table shows how the Peak Finder block processes the signal vector. The block does not consider the first and the last values of input signal.
[Previous, current, next] | Current value if it is an extremum | Index of current value if it is an extremum | Polarity of current value if it is an extremum |
---|---|---|---|
[9 6 10] | 6 | 1 | 0 |
[6 10 3] | 10 | 2 | 1 |
[10 3 4] | 3 | 3 | 0 |
[3 4 5] | –– | –– | –– |
[4 5 0] | 5 | 5 | 1 |
[5 0 12] | 0 | 6 | 0 |
For this example, the outputs at the block ports are:
Cnt ––
5
Idx –– [
1 2 3 5 6
]Val –– [
6 10 3 5 0
]Pol –– [
0 1 0 1 0
]