No BSD License  

Highlights from
findextrema.m

1.5

1.5 | 2 ratings Rate this file 3 Downloads (last 30 days) File Size: 683 Bytes File ID: #3586

findextrema.m

by Schuberth Schuberth

 

11 Jun 2003 (Updated 13 Jun 2003)

Finds minima and maxima of data.

| Watch this File

File Information
Description

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;

MATLAB release MATLAB 6.0 (R12)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (2)
10 Aug 2005 Jerry Wolf

This looks like a very useful function, and the feature of interpolated x-positions is cute. Unfortunately, in the 2nd case I tried it on, I found that it misses some extrema and misplaces others. See this example:

y=[-196.7906 -188.8165 -196.5088 -193.5867 -194.6516 -190.3382...
-186.7008 -199.9656 -192.8946 -187.4440 -186.5194 -183.2169...
-201.4095 -198.7111 -189.9841 -195.6190 -189.6214 -188.5710...
-190.1472 -197.9514 -185.7049];
[ma,mi]=findextrema(y);
figure; plot(y); hold on; plot(ma,y(round(ma)),'ro');plot(mi,y(round(mi)),'gs'); hold off

05 Dec 2005 robert haberman

This doesn't work for data exhibiting numerous strong maxima and minima.

Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
minima maxima findextrema Schuberth Schuberth 22 Oct 2008 07:02:59

Contact us at files@mathworks.com