stinemanSlopes: Estimate the slope of an interpolating function using an arc

Description Usage Arguments Value Note Author(s) References See Also Examples

Description

Returns estimates of the slope of an interpolating function that runs through a set of points in the xy-plane. The slopes are calculated using to the algorithm of Stineman (1980), i.e. from the tangent of circles passing through every three consecutive points.

Usage

1

Arguments

x,y

coordinates of points defining the interpolating function.

scale

if true (default) then the x and y values are normalized prior to the slope calculation.

Value

Returns an estimate of the slope of the interpolant at (x,y).

Note

This function is used as part of the Stineman interpolation function stinterp. It is rarely called directly by the user, and checking of x and y must be performed by the calling function.

Stineman's method provides a more robust interpolating function near abrupt steps or spikes in the point sequence than the alternative method based on a second degree interpolating polynomial, which is provided by the function parabolaSlopes (see the documentation of the function stinterp for further information), but it results in slightly less accuracy for smooth functions.

Author(s)

Tomas Johannesson

References

Stineman, R. W. A Consistently Well Behaved Method of Interpolation. Creative Computing (1980), volume 6, number 7, p. 54-57.

See Also

stinterp and parabolaSlopes.

Examples

1
2
3
4
5
## Interpolate a smooth curve
x <- seq(0,2*pi,by=pi/6)
y <- sin(x)
stinemanSlopes(x,y,scale=TRUE)
stinemanSlopes(x,y,scale=FALSE)

Example output

 [1]  1.116638e+00  7.932212e-01  3.535473e-01  0.000000e+00 -3.535473e-01
 [6] -7.932212e-01 -9.549297e-01 -7.932212e-01 -3.535473e-01  5.434010e-17
[11]  3.535473e-01  7.932212e-01  1.116638e+00
 [1]  1.098788e+00  8.110713e-01  4.407481e-01  2.268417e-17 -4.407481e-01
 [6] -8.110713e-01 -9.549297e-01 -8.110713e-01 -4.407481e-01 -1.587892e-16
[11]  4.407481e-01  8.110713e-01  1.098788e+00

stinepack documentation built on May 1, 2019, 10:10 p.m.