如何输出平滑的cspline曲线作为数据文件

use*_*499 10 smooth gnuplot output

有人知道如何为给定数据提取平滑cspline曲线的一些数据吗?

例如,存在具有对应于x和y值的2列的数据文件.我可以通过以下命令用平滑的cpline曲线绘制数据

p 'data' w lp, ""  smooth csplines
Run Code Online (Sandbox Code Playgroud)

我想将平滑的cpline曲线提取为另一个数据文件.

Mig*_*uel 13

这可以通过设置a来完成table.请考虑以下数据文件:

0 1
1 2
2 3
3 2
4 2
5 4
6 8
7 5
8 3
9 1
Run Code Online (Sandbox Code Playgroud)

数据本身及其csplines插值如下所示:

在此输入图像描述

要将插值打印到表格,请执行以下操作:

set samples 100
set table "table_100"
plot "data" smooth csplines
set samples 20
set table "table_20"
plot "data" smooth csplines
unset table
Run Code Online (Sandbox Code Playgroud)

set samples确定用于构造样条曲线的点数.你可以想象它:

set key left
plot "data" pt 7 t "Original data", \
     "table_100" w l t "Splines (100 samples)", \
     "table_20" w l t "Splines (20 samples)"
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述


Chr*_*oph 5

使用set table 'temp.dat'的绘制数据点重定向到一个外部文件

set table 'temp.dat'
plot 'myfile.dat' using 1:2 smooth cspline
unset table
Run Code Online (Sandbox Code Playgroud)

测试一下

plot 'myfile.dat' using 1:2 with points title 'original points',\
     'temp.dat' using 1:2 with lines title 'smoothed curve'
Run Code Online (Sandbox Code Playgroud)