Fast Local Extrema

version 6.0.0 (1.08 KB) by Moreno, M.
Fast local extrema calculation

27 Downloads

Updated 20 Apr 2022

View License

Calling x = extrema(X) returns a logical array whose elements are 1 (true) when a local extrema is detected in the corresponding element of 'X'. The function operates along the columns of 'X'. An example of the use of this function is:
t = 2 * pi * (0 : 1 / (1000 - 1) : 1)';
X = [t, exp(-t / 2) .* sin(10 * t)];
k = extrema(X(:, 2));
figure
hold on
plot(X(:, 1), X(:, 2))
plot(X(k, 1), X(k, 2), 'o')
axis equal

Cite As

Moreno, M. (2022). Fast Local Extrema (https://www.mathworks.com/matlabcentral/fileexchange/108134-fast-local-extrema), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2022a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!