gpt4 book ai didi

gnuplot - 如何在 Gnuplot 中绘制噪声值的平均值

转载 作者:行者123 更新时间:2023-12-01 00:55:28 25 4
gpt4 key购买 nike

是否可以过滤 Gnuplot 中的噪声并获得具有不同集合平均值的图?情节可以在下面看到。
2 by 3 grid of noise plots with time along the x-axis and temperature along the y axis

最佳答案

要平滑噪声曲线,您至少有两种策略:一种是使用平滑内核,例如高斯函数,它为您提供局部平均值。另一种方法是如果您知道数据的函数形式,则计算总平均值或插值函数。两者都可以用 gnuplot 来完成。

由于您没有提供数据文件,我生成了以下文件,其中填充了从 $RANDOM 获得的 1000 个随机值。 bash变量:

for i in `seq 1 1 1000`; do echo $RANDOM >> data; done

这应该会生成 0 - 32767 范围内的随机数据,也就是说,对于足够具有代表性的数据样本,平均值应该是 16383.5。让我们绘制它以查看原始数据的外观:
plot "data" t "data", 16383.5 t "theoretical average"

enter image description here

第一种策略是使用高斯核来平滑数据( smooth kdensity ):
plot "data" smooth kdensity t "data", 16383.5 t "theoretical average"

enter image description here

如您所见,此方法在中间提供了良好的平滑效果,但也考虑了边缘缺少数据点的情况。

为了防止这种情况发生,我可以通过提供具有带宽的第三列(在这种情况下等于 10)来增加平滑的“局部性”:
plot "data" u 0:1:(10) smooth kdensity t "data", 16383.5 t "theoretical average"

enter image description here

拟合的平均需要一个 fit :
fit a "data" via a
plot "data" t "data", a t "calculated average"

enter image description here

关于gnuplot - 如何在 Gnuplot 中绘制噪声值的平均值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28347501/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com