如何在gnuplot中绘制导入数据的函数? [英] How to plot a function of an imported data in gnuplot?

查看:271
本文介绍了如何在gnuplot中绘制导入数据的函数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我有几个数据点的文件.如何绘制它们的功能?例如,假设我有一个文件到xy列,并且想将sin(y)绘制为1/x的函数.

If I have a file of several data points. How can I plot a function of them? For example, suppose I have a file of to columns x and y and I want to plot sin(y) as a function of 1/x.

推荐答案

尝试一下:

plot "-" u (1/$1):(sin($2)) w l
    2.00000    0.16104
    3.00000    0.15604
    4.00000    0.40055
    5.00000    0.09972
    e

或者在不使用数据文件时,请使用parametric模式,该模式在

Or when not using data files make use of the parametric mode, which is described here

使用此数据文件Data.csv:

 0.00000    0.33371
 1.00000    0.13034
 2.00000    0.16104
 3.00000    0.15604
 4.00000    0.40055
 5.00000    0.09972
 6.00000    0.25204
 7.00000   -0.34172
 8.00000   -0.04733
 9.00000   -0.27211
10.00000    0.10229
11.00000   -0.30608
12.00000    0.11006
13.00000   -0.44390
14.00000   -0.16963
15.00000    0.03208
16.00000    0.32431
17.00000    0.15424
18.00000    0.16468
19.00000    0.24410
20.00000    0.34961

我可以运行以下脚本:

f(x) = kappa*x**2

fit f(x) "Data.csv" u (log($1)):(sin($2)) via kappa
plot "Data.csv" u 1:(sin($2)), f(x) w l

哪个给我这个情节:

当然,该配件完全没有意义^^.

Granted, the fitting does not make any sense at all^^.

您是否可能缺少适合自己的括号?!

Are you maybe missing some brackets in your fit?!

这篇关于如何在gnuplot中绘制导入数据的函数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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