Re: Getting peak value from a Graph in Plot command - pls help
- To: mathgroup at smc.vnet.net
- Subject: [mg23996] Re: [mg23953] Getting peak value from a Graph in Plot command - pls help
- From: BobHanlon at aol.com
- Date: Mon, 19 Jun 2000 01:45:38 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
In a message dated 6/18/2000 3:15:23 AM, fannews at email.com writes:
>I would be grateful if anyone knows if there is any command that I can
>use to extract the highest peak value from a graph in a Plot command?
>
This will handle multiple graphs
thePlot =
Plot[{E^(-x) * Sin[x], -0.75*E^(-Abs[x - Pi]) * Sin[x]}, {x, 0, 2Pi},
PlotStyle -> {RGBColor[0, 0, 1], RGBColor[0, 1, 0]},
DisplayFunction -> Identity];
pts = Cases[thePlot, x_?(Head[#] == Line &) :> x[[1]], {1, Infinity}];
yMax = Max[#] & /@ (Transpose[#][[2]] & /@ pts);
maxCoord = Flatten[Cases[pts, {x_, #}, {1, Infinity}] & /@ yMax, 1];
Show[{thePlot,
Graphics[{AbsolutePointSize[5], RGBColor[1, 0, 0], Point[#]} & /@
maxCoord]}, DisplayFunction -> $DisplayFunction];
Bob Hanlon