Determine when the graph becomes flat
19 次查看(过去 30 天)
显示 更早的评论
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 :)
0 个评论
回答(1 个)
Jan
2016-10-5
lastSteepIndex = find(diff(y) >= limit, 1, 'last')
Now you have the index of the last element with non-flat data.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Annotations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!