Main Content

Introducing Spline Fitting

Spline Overview

The Curve Fitting Toolbox™ spline functions are a collection of tools for creating, viewing, and analyzing spline approximations of data.Splinesare smooth piecewise polynomials that you can use to represent functions over large intervals, where it would be impractical to use a single approximating polynomial.

The spline functionality includes a tool that provides easy access to functions for creating, visualizing, and manipulating splines. The toolbox also contains functions that enable you to evaluate, plot, combine, differentiate, and integrate splines. Because all toolbox functions are implemented in the open MATLAB®language, you can inspect the algorithms, modify the source code, and create your own custom functions.

Key spline features:

  • Tools that let you create, view, and manipulate splines and manage and compare spline approximations

  • Functions for advanced spline operations, including differentiation, integration, break/knot manipulation, and optimal knot placement

  • Support for piecewise polynomial form (ppform) and basis form (B-form) splines

  • Support for tensor-product splines and rational splines (including NURBS)

In Curve Fitting Toolbox you can fit splines interactively or programmatically.

Interactive Spline Fitting

Use the Curve Fitter app or the Spline Tool to interactively create spline fits.

Open the Curve Fitter app by enteringcurveFitterat the MATLAB command line. Alternatively, on theAppstab, in theMath, Statistics and Optimization小组,单击Curve Fitter. The Curve Fitter app supports the same spline fitting options as thefitfunction.

Open the Spline Tool by enteringsplinetoolat the command line. The Spline Tool supports all spline functions. Use the tool to do the following:

  • Vary spline parameters and tolerances.

  • View and modify data, breaks, knots, and weights.

  • 查看样条的误差或样条的第一个或第二个衍生物。

  • Observe the toolbox commands that generated your spline.

  • Create and import data, including built-in instructive data sets, and save splines to the workspace.

For more information, seesplinetool.

编程样条拟合

Use thefit下面的函数:

  • Fit cubic spline interpolants to curves or surfaces.

  • 拟合平滑的花键和呈现形状的立方样条插值剂仅为曲线。

  • Fit thin-plate splines only to surfaces.

Curve Fitting Toolbox also provides specific splines functions that allow more control and flexibility when you fit splines. For example, use thecsapifunction, instead offitfitType调成"cubicinterp", if you want to do one of the following:

  • 例如,通过添加结合结果与其他细条结合。

  • Create vector-valued splines. You can usecsapi和scalars, vectors, matrices, and ND-arrays. Thefitfunction supports only scalar-valued splines.

  • Create other types of splines such as ppform, B-form, tensor-product, rational, and stform thin-plate splines.

  • 创建没有数据的花键。

  • 指定优惠, optimize knot placement, and use specialized functions for spline manipulation such as differentiation and integration.

For more information on how to create splines including B-form, tensor-product, NURBs, and other rational splines, seeSpline Construction.

See Also

Apps

Functions