フィルターのクリア

How to determine when the values in an array settle to a value within specified margins.

14 ビュー (過去 30 日間)
Im trying to find out when data output from simulink reaches a settled state, or settling time i guess of +- 2 percent.
Using find gets me the indeces of the data that fall in that region ie:
settlingTime = find(SimData{2} > 0.98 & SimData{2} < 1.02 );
Id like to know if theres a way to determine at what point the settlingTime array no longer jumps values, or when it no longer overshoots that 2 percent. At that point settlingTime should just count up by 1 from when the data no longer exceeds the margins until the end of the data.
To generalize, if i have an array, is there a way to extrant the index of the array where after that index the data incriments by 1, or i guess a specified pattern.
Thanks for any help that can be offered

採用された回答

Voss
Voss 2022 年 2 月 21 日
It sounds like you're going for something like this:
is_settled = SimData{2} > 0.98 & SimData{2} < 1.02;
if is_settled(end)
settled_idx = 1+find(~is_settled,1,'last');
else
settled_idx = [];
end
  2 件のコメント
Leo Rogers
Leo Rogers 2022 年 2 月 21 日
this was a huge help, thank you so much
Voss
Voss 2022 年 2 月 21 日
No problem, glad to help

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeStartup and Shutdown についてさらに検索

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by