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

    %% Use Regularized Impulse Response Model to Estimate State-Space Model  

% Copyright 2015 The MathWorks, Inc.


%%
% Load data. 
load regularizationExampleData eData;  

%% 
% Create a transfer function model used for generating the estimation data
% (true system). 
trueSys = idtf([0.02008 0.04017 0.02008],[1 -1.561 0.6414],1);   

%% 
% Obtain regularized impulse response (FIR) model. 
opt = impulseestOptions('RegulKernel','DC');
m0 = impulseest(eData,70,opt);  

%% 
% Convert the model into a state-space model and reduce the model order. 
m1 = balred(idss(m0),15);

%% 
% Obtain a second state-space model using regularized reduction of an ARX model. 
m2 = ssregest(eData,15);

%% 
% Compare the impulse responses of the true system and the estimated models.
impulse(trueSys,m1,m2,50);   
legend('trueSys','m1','m2');