Smoothing with acsplines
draws an approximating cubic spline, which doesn't go through your original data points.
A better approach could be to use cubic splines smooth csplines
, which go through all data points but may show overshoots for sharp peaks.
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:
The test.dat
file contains the points
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
And the script to plot them is
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'
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…