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

18 ビュー (過去 30 日間)
Yatish Yatish
Yatish Yatish 2019 年 10 月 10 日
回答済み: Matt J 2019 年 10 月 11 日
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 件のコメント
Yatish Yatish
Yatish Yatish 2019 年 10 月 11 日
編集済み: Yatish Yatish 2019 年 10 月 11 日
@Adam Danz Using max(max(f))
Adam
Adam 2019 年 10 月 11 日
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.

サインインしてコメントする。

採用された回答

Matt J
Matt J 2019 年 10 月 11 日
maxval=max(f(:));
[xmax,ymax]=find(f==maxval);

その他の回答 (0 件)

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by