splineZeros {DierckxSpline} | R Documentation |
Find the zeros of a spline starting with the control polygon.
splineZeros(object, maxiter)
object |
An object of class dierckx . |
maxiter |
maximum number of iterations allowed so the signs of the control polygon match those of the spline. |
As described in Dierckx(1993, pp. 16-22):
1. cP <- controlPolygon(object)
2. Evaluate the spline at the zeros of the control polygon.
3. While there are sign changes in the control polygon that are not matched by sign changes in the spline, insert knots, recompute the control polygon and the spline at the zeros of the control polygon. Iterate.
4. Use 'uniroot' to obtain the zero in each interval containing a sign change in the spline.
a matrix with one column for each of the outputs of 'uniroot':
root |
estimated zero |
f.root |
value of the spline at 'root' |
iter |
number of iterations required by 'uniroot' |
estim.prec |
estimated precision for [root] |
normal-bracket21bracket-normal
Spencer Graves
Dierckx, P. (1993) Curve and Surface Fitting with Splines, Oxford Science Publications.
curfit
,insert.dierckx
,predict.dierckx
,uniroot
xi <- 1:10 yi <- sin(xi) spli <- curfit(xi, yi, s=10) cPi <- controlPolygon(spli) x. <- seq(1, 10, length=201) plot(x., predict(spli, x.), type="l") points(xi, yi) abline(h=0) lines(cPi[, 1], cPi[, 2], lty=2) Zeros <- splineZeros(spli) abline(v=Zeros[, 1])