How do you find the max within a specified window?

9 ビュー (過去 30 日間)
Leah
Leah 2012 年 7 月 16 日
コメント済み: Alan Keenan 2021 年 7 月 14 日
so i have a plot where i want to find the maximum point within that plot. There is a set window or parameter that i want to find the maximum point. How do I find the x and y value of the point with the specified windows? thank you!

採用された回答

Image Analyst
Image Analyst 2012 年 7 月 16 日
編集済み: Image Analyst 2012 年 7 月 16 日
To find the max(es) within one specified window location:
[maxYValue maxXIndex] = max(signal(element1:element2));
where element1 and element2 say what element (index) you want to start and stop your window at.
Or, if you have the Image Processing Toolbox and you want to find the maximum in every window as it slides along your signal, then you can use imdilate().
allMaxes = imdilate(signal(element1:element2), ones(1, windowWidth));
  4 件のコメント
Image Analyst
Image Analyst 2021 年 7 月 14 日
@Alan Keenan, not sure what you mean. You can still use max() on times, maybe not all styles of times but certainly serial date vectors. Post your data in a new question if you still have questions.
Alan Keenan
Alan Keenan 2021 年 7 月 14 日
@ Image Analyst, the x axis is time from 0 to 6us. I want to use max(data) within two points in time, say between 2.0e-6 and 2.2e-6, however the expected syntax is element idices rather than time points. I will open a new question and thanks for your comments.

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

その他の回答 (1 件)

Steven Lord
Steven Lord 2021 年 7 月 14 日
Depending on whether you want the windows to overlap or not, the movmax function (which did not exist when the question was asked) may be of use as well.

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by