⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sp2bb.m

📁 演示matlab曲线拟和与插直的基本方法
💻 M
字号:
function spline = sp2bb(spline)
%SP2BB Convert from B-form to BBform.
%
%   SP2BB(SPLINE)  converts the B-form in SPLINE to the corresponding BB-form,
%   obtained by using knot insertion to increase the multiplicity
%   of each knot to its maximal value, namely the order of the spline.  
%
%   See also SP2PP, PP2SP, FN2FM.

%   Copyright 1987-2003 C. de Boor and The MathWorks, Inc.
%   $Revision: 1.16 $

if ~isstruct(spline), spline = fn2fm(spline); end

sizeval = fnbrk(spline,'dim');
if length(sizeval)>1, spline = fnchg(spline,'dz',prod(sizeval)); end

if iscell(spline.knots)   % we are dealing with a multivariate spline

   [t,coefs,n,k,d] = spbrk(spline);
   m=length(k);
   sizec = [d,n]; %size(coefs);
   for i=m:-1:1
      spi = sp2bb1(spmak(t{i},reshape(coefs,prod(sizec(1:m)),n(i))));
      knots{i} = spi.knots;  sizec(m+1) = spi.number;
      coefs = reshape(spi.coefs,sizec);
      if m>1
         coefs = permute(coefs,[1,m+1,2:m]); sizec = sizec([1,m+1,2:m]);
      end
   end
   spline = spmak(knots,coefs,sizec); spline.form = 'BB';
      
else
   spline = sp2bb1(spline);
end

if length(sizeval)>1, spline = fnchg(spline,'dz',sizeval); end

function spline = sp2bb1(spline)
%SP2BB1 Convert univariate spline from B-form to BBform.

[xi,m] = knt2brk(spbrk(spline,'knots'));
spline = sprfn(spline, brk2knt(xi,subplus(spbrk(spline,'order') - m)));
spline.form = 'BB';

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -