如何将平滑的Cspline曲线输出为数据文件 [英] How to output smooth cspline curve as a data file
问题描述
有人知道如何为给定数据提取平滑cspline曲线的一些数据吗?
Does anybody know how to extract some data of smooth cspline curve for a given data?
例如,有一个数据文件,其中有2列分别对应于x和y值.我可以通过以下命令绘制具有平滑cpline曲线的数据
For instance, there is a data file which has 2 columns corresponding to x and y values. I can draw the data with smooth cpline curve by the following commands
p 'data' w lp, "" smooth csplines
我想将平滑的cpline曲线提取为另一个数据文件.
I want to extract the smooth cpline curve as an another data file.
推荐答案
这可以通过设置table
来完成.考虑以下数据文件:
This can be done by setting a table
. Consider the following data file:
0 1
1 2
2 3
3 2
4 2
5 4
6 8
7 5
8 3
9 1
数据本身及其csplines
插值如下:
The data itself and its csplines
interpolation look like this:
要将插值打印到表中,请执行以下操作:
To print the interpolation to a table one does the following:
set samples 100
set table "table_100"
plot "data" smooth csplines
set samples 20
set table "table_20"
plot "data" smooth csplines
unset table
set samples
确定用于构造样条曲线的点数.您可以将其可视化:
set samples
determines the number of points used to construct the spline curve. And you can visualize it:
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)"
这篇关于如何将平滑的Cspline曲线输出为数据文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!