Experiment with some spline approximation methods
The Spline Tool is shown in the following figure comparing cubic spline interpolation with a smoothing spline on sample data created by adding noise to the cosine function.
Approximation Methods
The approximation methods and options supported by the GUI are shown below.
Approximation Method | Option |
---|---|
Cubic Interpolating Spline | Adjust the type and values of the end conditions. |
Smoothing Spline | Choose between cubic (order 4) and quintic (order 6) splines. Adjust the value of the tolerance and/or smoothing parameter. Adjust the weights in the error and roughness measures. |
Least-Squares Approximation | Vary the order from 1 to 14. The default order is 4, which gives cubic approximating splines. Modify the number of polynomial pieces. Add and move knots to improve the fit. Adjust the weights in the error measure. |
Spline Interpolation | Vary the order from 2 to 14. The default order is 4, which gives cubic spline interpolants. If the default knots supplied are not satisfactory, you can move them around to vary the fit. |
Graphs
You can generate and compare several approximations to the same data. One of the approximations is always marked as “current” using a thicker line width. The following displays are available:
Data graph. It shows:
The data
The approximations chosen for display in List of approximations
The current knot sequence or the current break sequence
Auxiliary graph (if viewed) for the current approximation. You can invoke this graph by selecting any one of the items in the View menu. It shows one of the following:
The first derivative
The second derivative
The error
By default, the error is the difference between the given data values and the value of the approximation at the data sites. In particular, the error is zero (up to round-off) when the approximation is an interpolant. However, if you provide the data values by specifying a function, then the error displayed is the difference between that function and the current approximation. This also happens if you change the y-label of the data graph to the name of a function.
Menu Options
You can annotate and print the graphs with the File > Print to Figure menu.
You can export the data and approximations to the workspace for further use or analysis with the File > Export Data and File > Export Spline menus, respectively.
You can create, with the File > Generate Code menu, a function file that you can use to generate, from the original data, any or all graphs currently shown. This file also provides you with a written record of the commands used to generate the current graph(s).
You can save, with the Replicate button, the
current approximation before you experiment further. If, at a later time, you click
on the approximation so saved, splinetool
restores everything to
the way it was, including the data used in the construction of the saved
approximation. This is true even if, since saving this approximation, you have
edited the data while working on other approximations.
You can add, delete, or move data, knots, and breaks by right-clicking in the graph, or selecting the appropriate item in the Edit menu.
You can toggle the grid or the legend in the graph(s) with the Tools menu.