# splinetool

Experiment with some spline approximation methods

## Description

`splinetool`

opens the Spline Tool, which lets you experiment with various spline approximation methods. It provides you with choices for data, including the option of importing some data from the workspace.

## Examples

## Input Arguments

## Tips

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.

**Select Approximation Methods**

The approximation methods and options supported by the tool 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. |

**Plot 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:

Data

Approximations chosen for display in

**List of approximations**Current knot sequence or the current break sequence

Auxiliary graph (if viewed) for the current approximation. You can view this graph by selecting any one of the items in the

**View**menu. It shows one of the following:First derivative

Second derivative

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.

**Try 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 graphs.

You can save, with the **Replicate** button, the current approximation before you experiment further. If, at a later time, you click the saved approximation, the tool restores everything to the way it was, including the data used in the construction of the saved approximation. The saved approximation persists even if 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 by selecting the appropriate item in the **Edit** menu.

You can toggle the grid or the legend in a graph with the **Tools** menu.

## Version History

**Introduced before R2006a**