spterms.m
来自「演示matlab曲线拟和与插直的基本方法」· M 代码 · 共 381 行 · 第 1/2 页
M
381 行
' for spaps, one gives the input tol as the n-vector ',...
' [tolerance, lam].']};
case 'kn'
term = 'knots';
mess = ...
{'';'KNOTS are parameters used in the B-form of a spline.';
'Any nondecreasing sequence t can serve as a knot sequence.';
['Assuming t has length n+k , there are exactly n B-splines of order k ',...
' associated with t , with the j-th Bspline having the knots t(j:j+k), all j.',...
' These n B-splines serve as a convenient basis for the space',...
' S_{k,t} of splines of order k with knot sequence t .'];'';
['The elements of this space are piecewise polynomial of order k with',...
' breaks at the knots, but their smoothness across each break depends on the',...
' multiplicity with which that break occurs in the knot sequence. The rule:'];'';
' number of smoothness conditions + knot multiplicity = order .'};
case 'en'
term = 'end knots';
mess = ...
{'';['When constructing the B-form of a cubic spline, the first four',...
' knots are usually chosen to equal the left end of the', ...
' interval of interest, and the',...
' last four knots are chosen to equal the right end of that',...
' interval (thereby making it the ''basic interval'' for the',...
' resulting B-form).'];'';
['These END KNOTS have no influence on the behavior of the spline on',...
' that interval of interest and could even be chosen to be distinct',...
' and lie outside that interval (which would increase the',...
' ''basic interval'' of the resulting B-form).'];'';
['More generally, for a spline of order k , the first and last k ',...
' knots in its B-form are usually chosen to equal the corresponding',...
' end points of the interval of interest and thereby become the end knots.']};
case 'er'
term = 'error';
mess = ...
{['The error is, by definition, the difference between the exact value',...
' and the approximation.'];'';
['In least-squares approximation and in smoothing, the error in the',...
' approximation f to the data (x(j), y(:,j)), j=1:length(x), is',...
' measured by the weighted sum of squares'];'';
' sum_j w(j) | y(:,j) - f(x(j)) |^2';'';
'for some nonnegative weights w .'};
case 'in'
term = 'interior knots';
mess = ...
{['The knots of a spline inside its basic interval are its INTERIOR',...
' KNOTS. Usually, some derivative of a spline has a jump across',...
' such a knot. The lowest order derivative in which a jump may',...
' occur depends on the multiplicity m of that knot and the order',...
' k of the spline: it''s the derivative of order k-m .'];'';
['For example, across a simple knot (m=1), a cubic spline (k=4)',...
' may have a jump in the 3rd derivative (3 = 4-1), but not in any',...
' lower-order derivative (like the 2nd, 1st, or 0th derivative).']};
case 'le'
term = 'least squares';
mess = ...
{['In (discrete) LEAST_SQUARES spline approximation, the element s ',...
' from the specified spline space closest to the data (x,y) is',...
' constructed, with the distance measured by the ERROR: ',...
' sum( w.*(y - s(x)).^2 ) .'];'';
'A SPLINE SPACE is specified by giving its knot sequence and its order.';
['The knot sequence is required to satisfy the Schoenberg-Whitney', ...
' Conditions wrto some subsequence of the given data sites, x .']};
case {'NU','nu'}
term = 'NURBS';
mess = ...
{'A rational spline in which each coefficient of the denominator spline';
['is an explicit factor of the corresponding coefficient of the',...
' numerator spline.']};
case 'ra'
term = 'rational spline';
mess = ...
{'A rational spline is a ratio of splines, that is a function of the form';...
'';' r(x) = s(x)/w(x),';''; ...
'with both s and w splines, of the same order and with the same knots or';...
'breaks, and with w scalar-valued, while s may be vector-valued.';'';...
'A rational spline may be in rBform or rpform which, in effect, is the';...
'B-form or ppform of the corresponding vector-valued spline';'';...
' R(x) = [s(x);w(x)].'};
case 'rB'
term = 'rBform';
mess = ...
{'The rBform of a rational spline r(x) = s(x)/w(x) provides its order,',...
' its knot sequence, and the coefficients for the B-form of the',...
' corresponding (vector-valued) spline R(x) = [s(x);w(x)].'};
case 'rp'
term = 'rpform';
mess = ...
{'The rpform of a rational spline r(x) = s(x)/w(x) provides its order,',...
' its break sequence, and the local polynomial coefficients for the',...
' ppform of the corresponding (vector-valued) spline R(x) = [s(x);w(x)].'};
case 'st'
term = 'stform';
mess = ...
{['The stform provides the centers, coefficients, and type of a function ',...
'of the form sum_j coefs(:,j)*psi_j(x) + p(x) , with p a lower-', ...
'order polynomial, and psi_j(x) = psi(x-c_j), all j. Here, the c_j are ',...
'the centers, and the function psi, called the basis function, and the ',...
'degree of the polynomial p are specified by the particular type. '];'';
'The thin-plate spline is a standard example.'};
case 'th'
term = 'thin-plate spline';
mess = ...
{'A thin-plate spline is any bivariate function of the form f(x) = ',...
'sum_j coefs(:,j) phi(norm(x-centers(:,j))^2) + coefs(:,end-2)*x(1) ',...
'+ coefs(:,end-1)*x(2) + coefs(:,end), with phi(t) := t log(t) .'};
case 'ce'
term = 'centers';
mess = ...
{'The centers of a stform are the sites by which the basis function of ',...
'that form is translated to provide the individual terms of that form.'};
case 'qu'
term = 'quintic smoothing spline';
mess = {...
['The QUINTIC smoothing spline differs from the cubic smoothing spline',...
' only in that its roughness measure involves the 3rd rather than the',...
' 2nd derivative. Correspondingly, it is a spline of order 6 rather than',...
' of order 4.'];'';
['In the Spline Toolbox, the quintic smoothing spline is provided by',...
' the command spaps . The level of desired smoothness is specified',...
' indirectly, by specifying a certain tolerance, and the command',...
' returns the smoothest spline within that tolerance of the given data.']};
case {'sp','Sc'} % this one, we have to split further
if isempty(findstr(' ',term))&&term(2)~='c'
term = 'spline';
mess = ...
{['That''s a hard one. Roughly speaking, a (univariate, polynomial) SPLINE',...
' is any more or less smooth piecewise polynomial function.']};
else
switch term(2)
case 'p'
term = 'spline interpolation';
case 'c'
term = 'Schoenberg-Whitney conditions';
end
mess =...
{['General spline interpolation to data (x,y) is carried out in this', ...
' toolbox with the command SPAPI, and requires, in addition to the data,',...
' specification of a knot sequence, t, that satisfies the SCHOENBERG-',...
'WHITNEY CONDITIONS wrto the given data sites, in the following sense.'];
'';['Assuming that x is nondecreasing and of length n , and assuming',...
' that also t is nondecreasing, the difference k := length(t) - n',...
' must be positive, and, further,'];'';
' t(i) <= x(i) <= t(i+k), for i=1:n ,';'';
['with equality allowed only when the relevant knot has multiplicity k', ...
' (as is typically the case for the endknots).'];'';
['If the knot sequence t satisfies the Schoenberg-Whitney conditions',...
' wrto the data sites x , then there is exactly one spline of order k',...
' with knot sequence t that matches the given data.'];'';
'It is this spline that is being supplied by the command spapi(t,x,y).';...
['The variant spapi(k,x,y), with k a natural number, supplies a knot', ...
' sequence t of length k+length(x) that satisfies the Schoenberg-',...
'Whitney conditions wrto x . See the help for spapi for further detail.']};
end
case 'or'
term = 'order';
mess = ...
{['The ORDER of a spline counts the number of coefficients in any',...
' one of its polynomial pieces.'];'';
'For example, a cubic spline is of order 4.'};
case 'pp'
term = 'ppform';
mess = ...
{['The PPFORM of a spline provides its breaks, its order, and the',...
' coefficients for the shifted power form of its polynomial pieces.']};
case 'si'
term = 'sites_etc';
mess = ...
{['The terms SITES and VALUES are used here instead of their',...
' oldfashioned counterparts, ABSCISSAE and ORDINATES.'];'';
['The data POINT (x(i),y(i)) tells us that, at the SITE x(i) ',...
', we would like the spline to take the VALUE y(i) .']};
otherwise
mess = {'nothing yet'};
end
if nargout>0
expl = mess;
else
msgbox(mess,['Explanation: ',term])
end
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?