c#.net 数组中的平滑曲线
我有一个 int 数组,并将该值绘制在图表中。 (使用 zedgraphcontrol)
在该曲线中我想使用 C#.net 找到局部最大值 我的想法是平滑曲线以消除噪音。 我怎样才能找到那些地方。
非常感谢您的所有回复
I have an array of int and I plot that values in a graph. (using zedgraphcontrol)
In that curve I want to find local maxima using C#.net
My idea is smoothing the curve to remove the noices.
How can I find that places.
many thanks for all of your replies
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不会尝试解决 Oleksii 在他的答案中提出的问题,但是我将展示一个如何在 ZedGraph 中平滑曲线的简单示例:
从 0.0F 到 1.0F 的值会影响平滑量,>1.0F 可能是不需要的。
用于平滑的源代码文档: http://zedgraph.sourceforge.net/documentation/html/P_ZedGraph_Line_IsSmooth .htm
Zedgraph 参考资料:
I won't attempt to address the points Oleksii addresses in his answer, however I will show a simple example of how to smooth a curve in ZedGraph:
Values from 0.0F to 1.0F affect the smoothing amount, >1.0F is likely undesirable.
Source code documentation for smoothing: http://zedgraph.sourceforge.net/documentation/html/P_ZedGraph_Line_IsSmooth.htm
Zedgraph References:
答案取决于上下文。如果您只需要找到局部最大值,那么您可以只使用一个区间(子数组)并执行简单的迭代
Math.Max()
。然而,这可能不是您想要的。正如您还提到的平滑,这与寻找局部最大值不同。您可以使用许多技术来实现此目的,这些技术基于关于面积、信号类型、时间、频率、空间、相位、您的需求、您的目标、您的假设等。
您可以从一些关于信号的探索性统计开始,以帮助您了解可以应用哪种技术。统计软件包(例如 SPSS、Minitab)和 Matlab 中提供了此类工具。查看信号图,尝试曲线拟合,也许首先尝试线性回归。从那里你可以看到要去哪里。
The answer depends on the context. If you only need to find local maximum, then you can just have an interval (sub-array) and do simple iterative
Math.Max()
. This is, however, may not be what you want.As you also mentioned smoothing, which is different from finding local maximum. There are many techniques you can use for that, which are based on area, signal type, time, frequency, space, phase, your needs, your goals, your hypothesis etc.
You can start with some exploratory statistics on the signal to help you in understanding which technique you can apply. Such tools are available in stats packages (e.g. SPSS, Minitab) and Matlab. Take a look at the signal plots, try curve fitting and maybe linear regression first. From there you can see where to go.