📄 spterms.m
字号:
function [expl,term] = spterms(term)
%SPTERMS Explanation of spline toolbox terms.
%
% EXPL = SPTERMS(TERM) returns a string, or cell array of strings, containing
% an explanation of the term specified by the string TERM.
% Here are the possibilities:
% 'B-form', 'basic interval'
% 'B-spline','breaks'
% 'cubic spline interpolation', 'endconditions'
% 'not-a-knot', 'clamped', 'second', 'periodic', 'variational', 'Lagrange'
% 'cubic smoothing spline', 'quintic smoothing spline'
% 'error'
% 'knots', 'end knots', 'interior knots'
% 'least squares'
% 'NURBS', 'rational spline', 'rBform', 'rpform'
% 'roughness measure'
% 'thin-plate spline', 'centers', 'stform', 'basis function'
% 'spline'
% 'spline interpolation', 'Schoenberg-Whitney conditions'
% 'order'
% 'ppform'
% 'sites_etc'
% 'weight in roughness measure'
%
% Only the first so many (at least 2, but usually no more than 2) letters
% of a term need to be supplied, with the optional second output argument
% providing the full term understood.
%
% SPTERMS(TERM) without an output argument returns nothing, but puts the
% explanation into a message box.
% Copyright 1987-2005 C. de Boor and The MathWorks, Inc.
% $Revision: 1.14.4.2 $ $Date: 2005/06/21 19:46:15 $
if ~ischar(term)||length(term)<2
error('SPLINES:SPTERMS:wrongterm','Input must be a string, of length>1.')
end
switch term(1:2)
case 'B-'
if length(term)<3
error('SPLINES:SPTERMS:unclearterm',...
'B-form OR B-spline?')
end
if term(3)=='f'
term = 'B-form';
mess =...
{['The B-form of a spline provides an order, a knot sequence, and',...
' the coefficients in a weighted sum of the B-splines (for that',...
' order and knot sequence) that adds up to that spline.']};
else
term = 'B-spline';
mess =...
{'';['The B(asic)-SPLINE with knot sequence t(i) < ... < t(i+k) is',...
' the pp function, unique up to scaling, of order k with breaks',...
' t(i:i+k), that is nonzero only inside the interval (t(i) .. t(i+k))',...
' and has k-2 continuous derivatives.'];'';
['This definition carries over to the more general knot sequence',...
' t(i) <= ... <= t(i+k) , except that, across a break that',...
' appears with multiplicity m>1 in the knot sequence,',...
' only the first k-1-m derivatives are continuous.'];'';
'A standard notation for this B-spline is B( . | t(i:i+k) ) .';
['In the Spline Toolbox, the B-splines are normalized so that they',...
' sum to 1,'];'';
['sum_{i=j-k+1:j} B( . | t(i:i+k) ) = 1 on the interval',...
' [t(j)..t(j+1)] .'];'';
['Use the GUI bspligui to generate pictures of some B-splines,',...
' and explore the dependence of a B-spline on its knots.']};
end
case 'ba'
switch term(5)
case 'c'
term = 'basic interval';
mess =...
{['The various forms of a spline incorporate a',...
' BASIC INTERVAL. It is the interval of interest.'];'';
['In the B-form (BBform, rBform), it is the interval given by its',...
' first and last knot.'];'';
['In the ppform (rpform), it is given by the first and last entry in',...
' its break sequence.'];'';
['The two kinds of form differ in that a spline in B-form is zero',...
' outside its basic interval, while a spline in ppform is defined',...
' outside its basic interval by continuation of its first,',...
' respectively, last polynomial piece.']};
case 's'
term = 'basis function';
mess = ...
{'The basis function of an stform is the function whose translates, ',...
'by the centers of that form, provide the individual terms in the ',...
'weighted sum that is the function described by that form.'};
end
case 'br'
term = 'breaks';
mess = ...
{[' A BREAK is a site at which two neighboring polynomial pieces',...
' of a pp function meet.'];'';
['Use the toolbox command fnbrk(cs,''breaks'') to extract the',...
' breaks, along with the endpoints of the ''basic interval'' of',...
' the pp function whose ppform is contained in the variable cs .']};
case 'cu'
if length(term)<8
error('SPLINES:SPTERMS:unclearterm',...
'cubic spline OR cubic smoothing spline?')
end
if term(8)=='p'
term = 'cubic spline interpolation';
mess = ...
{'';['A CUBIC SPLINE INTERPOLANT to given data x,y matches the given',...
' data exactly. Between any two neighboring data sites,',...
' x(i) and x(i+1), it is a cubic polynomial. Neighboring cubic',...
' polynomials match in value, first, and second derivative',...
' across their common data site.'];'';
['This determines the cubic spline completely up to two degrees',...
' of freedom, and these are usually prescribed as two',...
' END CONDITIONS, one at each end.'];'';};
else
term = 'cubic smoothing spline';
mess = ...
{'';'Schoenberg''s cubic SMOOTHING SPLINE s uniquely minimizes the weighted average';
'';
' p * sum( w.*(y - s(x)).^2 ) + (1-p) * integral (D^2 s)^2';
'';
['of an ERROR measure and a ROUGHNESS measure, for given data (x,y) and',...
' given SMOOTHING PARAMETER p (and D^2 s the 2nd derivative of s ).'];'';
['For p==1 , the smoothing spline is just the variational', ...
' spline interpolant.'];'';
['For p==0 , the cubic smoothing spline is the least-squares straight',...
' line approximation.']};
end
% end conditions
case 'no'
term = 'not-a-knot end condition';
mess = ...
{['The jump in the third derivative across the data site next to the',...
' end is set to zero. With that, the two cubic polynomial pieces',...
' involved become the same. In effect, the interpolant has no',...
' break or knot at that site. Hence the name ''not-a-knot''.']};
case 'cl'
term = 'clamped end condition'; % complete or clamped or first derivative
mess = ...
{['In clamped or complete cubic spline interpolation, the endslopes',...
' are set to specified values.']};
case 'se'
term = 'second end condition'; % second derivative
mess = ...
{'The second derivative at the two ends are set to specific values.'};
case 'pe'
term = 'periodic end condition';
mess = ...
{'With a:=x(1) and b:=x(end) the two endpoints, the three conditions';
' f(a) = f(b), Df(a) = Df(b), and D^2 f(a) = D^2 f(b) are enforced.'};
case 'va'
term = 'variational end condition'; % variational
mess = ...
{['In variational cubic spline interpolation, the second derivative',...
' at the two ends is set to zero. This is also called ''natural''',...
' cubic spline interpolation, with ''natural'' the term used in',...
' the Calculus of Variations for end conditions that arise when',...
' no end condition is explicitly enforced.'];'';
['The variational problem here is the minimization of the integral',...
' of the square of the second derivative of the function that',...
' matches the given data.']};
case 'La'
term = 'Lagrange end condition';
mess = ...
{['The endslope is made to agree with the slope of the cubic',...
' polynomial that matches the four data points nearest that end.']};
case 'ro'
term = 'roughness measure';
mess = ...
{'The roughness of a spline f of order 2*m is measured by the number';'';...
' integral lambda(t) | (D^m f)(t) |^2 dt';'';...
['with lambda a piecewise constant function with breaks at the data',...
' sites (and nowhere else). The default for lambda is the constant',...
' function, 1 .']};
case 'we'
term = 'weight in roughness measure';
mess = ...
{'The roughness of a cubic spline f is measured by the number';''; ...
' integral lambda(t) | (D^2 f)(t) |^2 dt';'';...
['with lambda a piecewise constant function with breaks at the data',...
' sites (and nowhere else). The default for lambda is the constant',...
' function, 1 .'];'';
['To specify lambda , provide, for i=2:n, its value lam(i-1) on the', ...
' interval (x_{i-1} .. x_i). In calling on csaps, this is done by', ...
' giving the input p as the n-vector [smoothing parameter, lam], while',...
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -