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

    %% Specify Intersample Behavior for Discrete-Time Frequency-Response Data
% This example shows the effect of intersample behavior on the estimation 
% of continuous-time models using discrete-time frequency-response data.
%% 
% Generate discrete-time frequency-response data. To do so, first 
% construct a continuous-time transfer function model, |sys|. 
% Then convert it to a discrete-time model, |sysd|, using the |c2d| command
% and first-order hold (FOH) method. Use the discrete-time model |sysd| to 
% generate frequency-response data at specified frequencies, |freq|.
sys = idtf([1 0.2],[1 2 1 1]);
sysd = c2d(sys,1,c2dOptions('Method','foh'));
freq = logspace(-1,0,10);
FRdata = idfrd(sysd,freq);
%%
% |FRdata| is discrete-time data. The software sets the |InterSample|
% property of |FRdata| to |'foh'|, which is the discretization method that 
% was used to obtain |sysd| from |sys|.
%%
% Estimate a third-order continuous-time transfer function from the 
% discrete-time data.
model1 = tfest(FRdata,3,1)
%%
% |model1| is a continuous-time model, estimated using discrete-time 
% frequency-response data. The underlying continuous-time dynamics of the 
% original third-order model |sys| are retrieved in |model1| because the
% correct intersample behavior is specified in |FRdata|.
%%
% Now, specify the intersample behavior as zero-order hold (ZOH), and
% estimate a third-order transfer function model.
FRdata.InterSample = 'zoh';
model2 = tfest(FRdata,3,1)
%%
% |model2| does not capture the dynamics of the 
% original model |sys|.
% Thus, sampling related errors are introduced in the model estimation 
% when the intersample behavior is not correctly specified.