From: Helen Forbes on
Hi
From a graph with min and max points already plotted, is it possible to work backwards and find a point the lowest point before the firsat maximum and the same for the last maximum but looking forwards!???

Helena G
From: Walter Roberson on
Helen Forbes wrote:

> From a graph with min and max points already plotted, is it possible to
> work backwards and find a point the lowest point before the firsat
> maximum and the same for the last maximum but looking forwards!???

"maximum" is a superlative, like "best"; a point is either max(y) or it
isn't -- a point cannot be "more maximum" than another.

You can define a "local maximum", but if the graph might have noise, so
that y(K) might be less than y(K-1) because of the noise or due to
computational round-off, then how do you define "the first maximum"?

In the absence of noise and round-off, the first local maximum is the
first point such that y(K+1) < y(K)

idx = find(y(2:end) < y(1:end-1), 1, 'first')

and the lowest point before that would be

[minval, minidx] = min(y(1:idx-1))