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

    %% Generate Empirical Transfer Function Using Periodic Input  
% Generate a periodic input, simulate a system with it, and compare the
% frequency response of the estimated model with the original system at
% the excited frequency points.   

% Copyright 2015 The MathWorks, Inc.


%% 
% Generate a periodic input signal and output signal using simulation. 
m = idpoly([1 -1.5 0.7],[0 1 0.5]);
u = iddata([],idinput([50,1,10],'sine'));
u.Period = 50;
y = sim(m,u);  

%% 
% Estimate an empirical transfer function. 
me = etfe([y u]);

%% 
% Compare the empirical transfer function with the original model. 
bode(me,'b*',m,'r')