Main Content

Postprocessing Splines

You can use the following commands with any example spline, such as thecs,chandspexamples constructed in the sectionCubic Spline Interpolation.

首先构造一个花键,例如:

sp = spmak(1:6,0:2)

To display a plot of the spline:

fnplt(sp)

To get the value ata, use the syntaxfnval(f,a), for example:

fnval(sp,4)

To construct the spline's second derivative:

DDf = fnder(fnder(sp))

An alternative way to construct the second derivative:

DDf = fnder(sp,2);

To obtain the spline's definiteintegral over an interval [a..b], in this example from 2 to 5:

diff(fnval(fnint(sp),[2;5]))

To compute the difference between two splines, use the formfncmb(sp1,'-',sp2), for example:

fncmb(sp,'-',DDf);