MATLAB Answers

0

How to find the x and y coordinates corresponding to a given value of f(x,y)?

Asked by Yatish Yatish on 10 Oct 2019
Latest activity Answered by Matt J
on 11 Oct 2019
I have plotted f(x,y). I have obtained the maxima of the plot and now, I would like to know the values of x and y at which I have obtained this maxima.

  3 Comments

How did you obtain the maxima?
doc max
shows you that there are two output arguments from the max function. The seconod gives you the location at which the max is found. The first, obviously, is the max itself. Those are your x and y. Or at least an index into an x vector, to be more precise.

Sign in to comment.

1 Answer

Answer by Matt J
on 11 Oct 2019
 Accepted Answer

maxval=max(f(:));
[xmax,ymax]=find(f==maxval);

  0 Comments

Sign in to comment.