www.gusucode.com > mbcmodels 工具箱 matlab 源码程序 > mbcmodels/@localtruncps/localtruncps.m

    function ts = localtruncps(ord,knots)
%LOCALTRUNCPS Constructor for truncated power series model
%
%  M = LOCALTRUNCPS constructs a local power series model.

%  Copyright 2000-2007 The MathWorks, Inc. and Ford Global Technologies, Inc.


if nargin==0
    ord= 3;
    knots=1;
elseif nargin==2 && strcmp(ord,'nfactors')
    % L = localpsline('nfactors',nf)
    if knots~=1
        error(message('mbc:localpsline:InvalidValue'));
    end
    ord = 3;
    knots = 1;
end

ts.knots  = knots;
ts.order  = ord;

mlin = xreglinear('nfactors',1);
mlin = update(mlin,ones(ts.order+length(ts.knots),1));

ts = class(ts,'localtruncps',localmod,mlin);

n = size(ts,1);
ts = AddFeat(ts,zeros(n,1),1:n);