How to get the time when a variabile reaches the maximum value?

7 ビュー (過去 30 日間)
Antonio Cristian Arca
Antonio Cristian Arca 2020 年 11 月 8 日
コメント済み: Ameer Hamza 2020 年 11 月 9 日
Hi everyone,
I would like to create a function where provides as output the period in which a variable reaches is maximum value.
For example :
x = [1 20 10 4 12]
How can I get as output in a function the sitting of 20? The function must return = 2
because in the second place there is the most high value.
I don't know where to start from.

採用された回答

madhan ravi
madhan ravi 2020 年 11 月 8 日
doc max
  3 件のコメント
Antonio Cristian Arca
Antonio Cristian Arca 2020 年 11 月 8 日
I'am sorry what did you mean?
"doc max" doesn't work. :/
Can you show me how to do it whit this vector please?
x = [1 20 10 4 12]
Ameer Hamza
Ameer Hamza 2020 年 11 月 9 日
'doc max' is to see the documentation of max() function. If you open the documentation, you will see that it can be used like this
x = [1 20 10 4 12];
[~, idx] = max(x)

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

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by