findextrema.m

Finds minima and maxima of data.
2K Downloads
Updated Fri, 13 Jun 2003 10:34:09 +0000

No License

FINDEXTREMA - finds minima and maxima of data

If 'y' is the data the function finds the maximas 'ma' and minimas 'mi'.
The x-position of the extrema are interpolated.

Usage: [ma,mi]=findextrema(y);

Example:
x=-10:0.1:10; y=sin(x);
[ma,mi]=findextrema(y);
plot(y); hold on; plot(ma,y(round(ma)),'ro'); plot(mi,y(round(mi)),'gs'); hold off;

Cite As

Schuberth Schuberth (2024). findextrema.m (https://www.mathworks.com/matlabcentral/fileexchange/3586-findextrema-m), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R12
Compatible with any release
Platform Compatibility
Windows macOS Linux
Categories
Find more on Interpolation in Help Center and MATLAB Answers

Community Treasure Hunt

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

Start Hunting!
Version Published Release Notes
1.0.0.0