Determine when the graph becomes flat

Hi! I have a set of x and y-data which I have plotted in a diagram. I want to find a way to plot a horizontal line in my diagram when my graph (y-values) becomes flat for increasing x, i.e. when y(n+1)-y(n) is less than some number.
Is there a way I can do that using a loop or something? I appreciate all your help :)

回答 (1 件)

Jan
Jan 2016 年 10 月 5 日

0 投票

lastSteepIndex = find(diff(y) >= limit, 1, 'last')
Now you have the index of the last element with non-flat data.

1 件のコメント

LB
LB 2016 年 10 月 6 日
Thank you, this was very useful!

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

カテゴリ

タグ

質問済み:

LB
2016 年 10 月 5 日

コメント済み:

LB
2016 年 10 月 6 日

Community Treasure Hunt

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

Start Hunting!

Translated by