www.gusucode.com > ident 案例代码 matlab源码程序 > ident/EstimateInitialStatesofStateSpaceModelExample.m

    %% Estimate Initial States of State-Space Model  
% Estimate an |idss| model and simulate it such that the response of the
% estimated model matches the estimation data's output signal as closely
% as possible.   

% Copyright 2015 The MathWorks, Inc.


%% 
% Load sample data. 
load iddata1 z1;   

%% 
% Estimate a linear model from the data. 
model = ssest(z1,2);    

%% 
% Estimate the value of the initial states to best fit the measured output
% |z1.y|. 
x0est = findstates(model,z1,Inf);   

%% 
% Simulate the model. 
opt = simOptions('InitialCondition',x0est);
sim(model,z1(:,[],:),opt);