g = fnxtr(f,order)
g = fnxtr(f,order) returns
the spline (in ppform) that agrees with the spline in
the latter's basic interval but is a polynomial of the given
order outside it, with 2 the default for
in such a way that the spline in
g satisfies at
order smoothness conditions at the ends of
basic interval, i.e., at the new breaks.
f must be in B-form, BBform, or ppform.
order can be any nonnegative integer,
useful mainly when
order is positive but less than
the order of
order is zero, then
the same spline as
fn2fm(f,'B-) but is in ppform
and has a larger basic interval.
order is at least as big as
g describes the same pp as f
uses two more pieces and has a larger basic interval.
f is m-variate, then
be an m-vector, in which case
the matching order to be used in the
exactly the same as
fn2fm(f,'pp'). This unusual
option is useful when, in the multivariate case, extrapolation is
to take place in only some but not all variables.
fnxtr(f) is the same
Example 1. The cubic smoothing
spline for given data
like any other `natural' cubic spline, required to have zero second
derivative outside the interval spanned by the data sites. Hence,
if such a spline is to be evaluated outside that interval, it should
be constructed as
s = fnxtr(csaps(x,y)). A Cubic Smoothing Spline Properly Extrapolated, generated
by the following code, shows the difference.
rng(6); x = rand(1,21); s = csaps(x,x.^3); sn = fnxtr(s); fnplt(s,[-.5 1.4],3), hold on, fnplt(sn,[-.5 1.4],.5,'r',2) legend('cubic smoothing spline','... properly extrapolated') hold off
A Cubic Smoothing Spline Properly Extrapolated
Example 2. Here is the plot of a bivariate B-spline, quadratically extrapolated in the first variable and not at all extrapolated in the second, as generated by
A Bivariate B-spline Quadratically Extrapolated In One Direction