Simple operation with vectors

6 ビュー (過去 30 日間)
aurc89
aurc89 2015 年 2 月 23 日
コメント済み: aurc89 2015 年 2 月 23 日
I have two vectors, x and y, and I plot the function y=f(x) with the command plot(x,y). I need to know what is the value of x corresponding to the maximum value of y. For example if
x=[1.2 1.4 1.6 2.5 3.7]
and
y=[3.2 4.8 5.6 4.4 3.1],
then I have to obtain 1.6, since the third element of x corresponds to the maximum value of y. How can I implement this command? Thanks

採用された回答

W. Owen Brimijoin
W. Owen Brimijoin 2015 年 2 月 23 日
Location of the max y values as the index into x:
x(y==max(y))
  1 件のコメント
aurc89
aurc89 2015 年 2 月 23 日
Thank you

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeAnnotations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by