gnuplot中的平滑峰 [英] smooth peaks in gnuplot

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

问题描述

我在f(0)= 0的点x_i(函数f未知,仅在数值上)具有数据点f(x_i).数据显示在小x处具有峰状结构,随后出现缓慢的肩部衰减较大的x,它位于最大值的一半处.我想绘制通过这些数据点的平滑线. 如果我使用贝塞尔曲线,则确实f(0)= 0可以,但是峰值明显降低了(约25%).如果使用acsplines,则峰值看起来会更好一些,但不会保持f(0)= 0. 如何在不丢失重要信息(f(0)= 0)或分布的峰高的情况下平滑该数据集?

I have datapoints f(x_i) at points x_i (function f not known, only numerically) with f(0) = 0. The data show a peaklike structure at small x, to be followed by a slow shoulder-falloff at larger x that sets in half-way down from the maximum. I want to plot smoothed lines through these data points. If I use bezier then indeed f(0)=0 is ok, but the peak is significantly (by about 25%), lowered. If I use acsplines then the peak looks somewhat better, but f(0) = 0 is not maintained. How can I smooth that dataset without loosing vital info (f(0)=0) or the peak-height of the distribution?

推荐答案

使用acsplines进行平滑绘制了近似三次样条,该样条不会通过原始数据点.

Smoothing with acsplines draws an approximating cubic spline, which doesn't go through your original data points.

更好的方法可能是使用三次样条线smooth csplines,它遍历所有数据点,但可能会显示尖峰的过冲.

A better approach could be to use cubic splines smooth csplines, which go through all data points but may show overshoots for sharp peaks.

在您的情况下,可能最好的解决方案是使用单调三次样条线smooth mcsplines,它们可以保持原始数据点的单调性和凸性(请参见FN Fritsch和RE Carlson,单调分段三次插值法",SIAM Journal on数值分析,第238页,第238-246页(1980).

The probably best solution in your case is to use monotonic cubic splines, smooth mcsplines, which maintain the monotonicity and convexity of the original data points (see F.N. Fritsch and R.E. Carlson, "Monotone Piecewise Cubic Interpolation", SIAM Journal on Numerical Analysis 17, pp. 238-246 (1980)).

这是一个简短的示例,显示了这些差异:

Here is a short example which shows these differences:

test.dat文件包含点

0 0
0.2 1
0.4 10
0.6 80
1 30
2 20
3 13
4 7
5 2
6 1 
7 0

绘制它们的脚本是

set xzeroaxis
set style data lines
set samples 500
plot 'test.dat' u 1:2 smooth acsplines title 'acsplines', \
     '' u 1:2 smooth csplines title 'csplines', \
     '' u 1:2 smooth mcsplines lw 2 title 'mcsplines',\
     '' u 1:2 w p pt 7 title 'data points'

这篇关于gnuplot中的平滑峰的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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