2015-02-05 109 views
4

是否可以過濾Gnuplot中的噪音並獲得具有不同組的平均值的圖?情節可以在下面看到。如何繪製Gnuplot中噪音值的平均值

2 by 3 grid of noise plots with time along the x-axis and temperature along the y axis http://oi61.tinypic.com/2w54rd0.jpg

+0

您是否想要將一個曲線作爲四條曲線的平均值,還是要過濾每條曲線? – Christoph 2015-02-05 16:19:21

+0

嘿克里斯托夫,我想平均每個圖中的值。但我想平均分在不同的部分,並因此順應這一趨勢。我不希望t_init和t_final之間的固定平均值。 – Physther 2015-02-06 17:21:53

回答

4

爲了平滑曲線吵你至少有兩種策略:一種是使用一個平滑的內核,例如高斯函數,它給你當地的平均水平。另一個是計算總平均數或插值函數,如果你知道數據的功能形式。兩者都可以用gnuplot完成。

既然你不提供你的數據文件,我已經產生充滿來自$RANDOM bash的變量獲得1000個隨機值以下文件:

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

如你所見,這種方法在中間給你一個很好的平滑,但也考慮到了e中缺乏數據點當選總監。

爲了防止這種情況發生,我可以通過與帶寬供給第三列增加所述平滑的「局部性」(等於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

+0

嘿米格爾, 謝謝你很好的答案。如果人們在整個時間間隔內平均,這肯定是有幫助的。是否有可能獲得平均時間短的序列?例如,t = 0和t = 5之間的平均值,然後繼續t = 5,t = 10。基本上從平均水平走到平均水平。這可能嗎? – Physther 2015-02-06 17:23:50

+0

你可以像這樣設置間隔'fit [0:5] a ...' – Miguel 2015-02-06 18:15:16