find the maximum value of a vector within a defined range

17 ビュー (過去 30 日間)
ignacio bobadilla tapia
ignacio bobadilla tapia 2021 年 6 月 8 日
回答済み: KSSV 2021 年 6 月 8 日
Along with hello, I need to find the maximum value of a vector within a defined range, so I attach the data in a .txt; the x-axis is a time vector of
t=0:10:1441, being the range [7.8511e+03 8.9426e+03] which I need to know the maximum value, the y-axis is the attached data. Thank you.

回答 (1 件)

KSSV
KSSV 2021 年 6 月 8 日
If (t,y) is your data and you want find the max in the range [a b].
idx = y >= a & y <= b ; % get the values lying in [a b]
ti = t(idx) ;
yi = y(idx) ;
[val,idx] = max(yi) ;
[ti(idx) val]

カテゴリ

Help Center および File ExchangeProblem-Based Optimization Setup についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by