How I can write in code for the Maximum value of 'Y' from left hand side not from right hand side in following figure?

1 回表示 (過去 30 日間)

採用された回答

Dyuman Joshi
Dyuman Joshi 2022 年 8 月 2 日
Answering according to the image
x=[1 2 3 4 5 6 7 8 9 10 11 12];
y=[3 4 3 2 1 2 3 4 5 6 5 4];
plot(x,y)
locmax=islocalmax(y)
locmax = 1×12 logical array
0 1 0 0 0 0 0 0 0 1 0 0
i=find(locmax,1)
i = 2
maxy=y(i)
maxy = 4
maxx=x(i)
maxx = 2

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeAudio and Video Data についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by