Gnuplot累积栏问题 [英] Gnuplot Cumulative Column Question

查看:75
本文介绍了Gnuplot累积栏问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些数据.

#Time  Distance
 1   3
 2   5
 4   9
 8  11
12  17
14  20
16  34
20  40

我想在gnuplot中绘制累积距离wrt时间...(应该很容易),但是我不知道如何.

I want to plot the cumulative distance wrt time in gnuplot ... (it should be easy) but I do not know how.

x

推荐答案

对于仍在寻找这种东西的任何人,如果您的gnuplot版本是4.4或更高版本,则可以执行以下操作:

For anyone still looking for this sort of thing, If your gnuplot version is 4.4 or newer, you can do the following:

a=0
#gnuplot 4.4+ functions are now defined as:  
#func(variable1,variable2...)=(statement1,statement2,...,return value)
cumulative_sum(x)=(a=a+x,a)
plot "test.dat" using 1:(cumulative_sum($2))

这篇关于Gnuplot累积栏问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆