计算一系列绘图值中增长最快/下降最快的部分
我有一系列绘制的值 (x, y)。我正在寻找一种方法来识别增长/下降速度最快的段 {(Xi, Yi), (Xi+1, Yi+1)} 。 在示例图像中,这些段被标记并具有以下 X 坐标 (516, 550) 表示最快增加的段,(620, 635) 表示最快减少的段。我如何定义一个算法来做到这一点?
I have a series of plotted values (x, y). I'm searching for a way to identify the segments {(Xi, Yi), (Xi+1, Yi+1)} with the fastest growing/decresing rate.
In example image, these segments are tagged and have the following X coords (516, 550) for the fastest increasing segment and (620, 635) for the fastest decreasing segment. How can I define an algorithm to do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
计算每条线段的斜率。跟踪坡度的最大值和最小值。这些将分别对应于增长率最大和下降率最大的部分。
Calculate the slope of each line segment. Keep track of the maximum and minimum values of the slope. These will correspond to the segments with the greatest rate of increase and the greatest rate of decrease, respectively.
以下示例代码应该为您提供解决问题的方法:
我创建了一个玩具数据集,并找到了 y 变化最大的点。请注意,此处假设等距点(x 线性增加)。你的数据分布均匀吗?
结果图:

The following example code should provide you with a way forward in solving your problem:
I have created a toy data set, and found the point where y changes the most. Note that equally spaced points (x increases linearly) is assumed here. Is your data evenly spaced?
Resulting plot:
