资源简介
在学习B样条曲线的时候总是找各种实现样条曲线的方法,参考了OpenGL,还有论坛里用QT实现的方式,在查matlab的实现方式的时候总是找不到这个工具包,无奈只能下载完整的matlab了。这里上传这个工具箱给大家备用
代码片段和文件信息
function [knotsk] = aptknt(tauk)
%APTKNT Acceptable knot sequence
%
% APTKNT(TAUK) returns for a given nondecreasing sequence TAU with
% TAU(i) < TAU(i+K-1) all i a knot sequence KNOTS for which the
% Schoenberg-Whitney conditions
%
% KNOTS(i) < TAU(i) < KNOTS(i+K) i=1:length(TAU)
%
% hold (with equality only for the first or last knot) ensuring that
% the space of splines of order
% K := min(Klength(TAU))
% with knot sequence KNOTS has a unique interpolant to arbitrary data
% at the data sites TAU; the K used is optionally returned.
%
% For example for strictly increasing x and given corresponding y
%
% sp = spapi(aptknt(xk)xy);
%
% gives a spline f of order min(klength(x)) satisfying f(x(i)) = y(i)
% all i (and the same result is obtained by spapi(kxy) ).
% Be aware though of the fact that for highly nonuniform x the
% determination of this spline can be ill-conditioned leading possibly
% to very strange behavior away from the interpolation points.
%
% At present the knot sequence chosen here is the initial guess used for
% the iterative determination of the ‘optimal‘ knots in OPTKNT.
%
% See also AUGKNT AVEKNT NEWKNT OPTKNT.
% Copyright 1987-2008 The MathWorks Inc.
% $Revision: 1.1.6.1 $ $Date: 2009/12/22 18:48:34 $
% If tau(1) <= ... <= tau(n) with no more than k-2 consecutive equalities
% and n>k then the output xi = aveknt(tauk) is strictly increasing and
% for any a % the above Schoenberg-Whitney conditions wrto tau .
%
% Indeed then
% knots(1:k) = a < tau(1) <= ... <= tau(k)
% while for i=1:n-k
% knots(k+i) = xi(i) = (tau(i+1)+...+tau(i+k-1))/(k-1)
% hence (using the fact that at most k-1 consecutive tau‘s can be equal)
% tau(i) < knots(k+i) < tau(i+k) i=1:n-k
% and finally
% tau(n-k+1) <= ... <= tau(n) < b = knots(n+[1:k]).
% Letting now a --> tau(1) and b --> tau(end) will not change any of these
% inequalities except those involving the first and last data site may not
% be strict any more. But that is ok since these will be the endpoints of the
% corresponding basic interval hence only right respectively left limits
% matter there.
n = length(tau);
if n<2 error(‘SPLINES:APTKNT:toofewTAU‘ ...
‘There must be at least two (distinct) sites.‘) end
k = max(1min(kn)); dtau = diff(tau);
if any(dtau<0)
error(‘SPLINES:APTKNT:TAUdecreasing‘ ...
‘The site sequence must be nondecreasing.‘) end
if k==1 % simply use midpoints between data sites
if ~all(dtau)
error(‘SPLINES:APTKNT:TAUmulttoolarge‘ ...
‘For k==1 the site sequence must be strictly increasing.‘)
end
knots = [tau(1) tau(1:n-1)+dtau/2 tau(n)];
else
if any(tau(k:n)==tau(1:n-k+1))
error(‘SPLINES:APTKNT:TAUmulttoolarge‘ ...
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 3124 2009-12-22 13:48 splines\aptknt.m
文件 2084 2009-12-22 13:48 splines\augknt.m
文件 1057 2009-12-22 13:48 splines\aveknt.m
文件 2166 2009-12-22 13:48 splines\bkbrk.m
文件 1464 2009-12-22 13:48 splines\brk2knt.m
文件 1692 2009-12-22 13:48 splines\bspline.m
文件 4903 2009-12-22 13:48 splines\chbpnt.m
文件 9289 2009-12-22 13:48 splines\chckxywp.m
文件 4520 2010-08-03 17:45 splines\Contents.m
文件 10322 2009-12-22 13:48 splines\csape.m
文件 4708 2009-12-22 13:48 splines\csapi.m
文件 11713 2009-12-22 13:48 splines\csaps.m
文件 2611 2009-12-22 13:48 splines\cscvn.m
文件 8805 2009-12-22 13:48 splines\fn2fm.m
文件 6536 2009-12-22 13:48 splines\fnbrk.m
文件 1436 2009-12-22 13:48 splines\fnchg.m
文件 20459 2010-04-24 14:06 splines\fncmb.m
文件 5350 2009-12-22 13:48 splines\fnder.m
文件 3952 2009-12-22 13:48 splines\fndir.m
文件 3514 2009-12-22 13:48 splines\fnint.m
文件 3065 2009-12-22 13:48 splines\fnjmp.m
文件 2117 2009-12-22 13:49 splines\fnmin.m
文件 7537 2009-12-22 13:49 splines\fnplt.m
文件 2489 2009-12-22 13:49 splines\fnrfn.m
文件 8121 2009-12-22 13:49 splines\fntlr.m
文件 3714 2009-12-22 13:49 splines\fnval.m
文件 5352 2009-12-22 13:49 splines\fnxtr.m
文件 14423 2010-06-11 11:49 splines\fnzeros.m
文件 661 2009-12-22 13:49 splines\franke.m
文件 1425 2009-12-22 13:49 splines\getcurve.m
............此处省略126个文件信息
- 上一篇:MATLAB仿真电偶极子的电场线与等势线
- 下一篇:天线的波瓣图MATLAB仿真
评论
共有 条评论