Re: How to get the maximums of a curve
- To: mathgroup at smc.vnet.net
- Subject: [mg66865] Re: How to get the maximums of a curve
- From: "Valeri Astanoff" <astanoff at yahoo.fr>
- Date: Fri, 2 Jun 2006 04:08:27 -0400 (EDT)
- References: <e5js8v$e44$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Hi Simon, Here is a quick DIY way to find local maximums (just an example) : In[1]:=data={{0,1.09},{1,2.01},{2,1.92},{3,1.18},{4,0.29}, {5,0.109},{6,0.801},{7,1.66},{8,2.064},{9,1.47}, {10,0.518},{11,0.0379},{12,0.471},{13,1.514},{14,2.017}, {15,1.65}}; xmin=0; xmax=15; In[2]:=f=Interpolation[data]; In[3]:=ListPlot[Table[{x,f[x]},{x,xmin,xmax,0.1}] ,PlotJoined->True] Out[3]= - Graphics - In[4]:=t=Table[FindRoot[f'[x] == 0,{x,u}],{u,xmin,xmax,0.1}]; [warning interpolation messages...] In[5]:={x,f[x]} /. Select[Union[t, SameTest -> (Abs[(x/.#2)-(x/.#1)]<10^-5&)] , f''[x/.#] < 0 && xmin < (x /. #) < xmax&] Out[5]={{1.37679,2.07527},{7.99549,2.06401},{14.1378,2.02555}} hth V.Astanoff