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

    function L = pevinit(L,X,Y,~)
%PEVINIT initialize model to calculate pev
% 
% L = pevinit(L,X,Y);

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

if nargin>=3
    if get(L,'allfitted')
        mdls = get(L,'models');
        for i=1:length(mdls)
            mdls{i} = init(mdls{i},X,Y);
        end
        L.xregmulti= set(L.xregmulti,'internalmodels',mdls);
        
    else
        m= get(L.xregmulti,'currentmodel');
        m = init(m,X,Y);
        
        L.xregmulti= set(L.xregmulti,'internalcurrent',m);
    end
end

function m = init(m,X,Y)
[X,Y]= checkdata(m,X,Y);

if isa(m,'xregarx')
    m= set(m,'ycode',Y);
    
    % initialize initial conditions
    m= set(m,'InitialConditions',Y(1));
end
m = InitModel(m,X,Y,[],1);