www.gusucode.com > control 案例程序 matlab源码代码 > control/ConvertFromOneModelTypeToAnotherExample.m

    %% Convert From One Model Type to Another  
% This example shows how to convert a numeric LTI model from one type (|pid|)
% to another type (|tf|). 
%
% In general, you can convert a model from one type to another type using
% the model-creation command for the target type. For example, you
% can use the |tf| command to convert an |ss| model to transfer function
% form, or use the |ss| command to convert a |zpk| model to state-space form.   

%% 
% Create a PID controller. 
pid_sys = pid(1,1.5,3)  

%% 
% Convert |pid_sys| to a transfer function model. 
C = tf(pid_sys) 

%%
% |C| is a |tf| representation of |pid_sys|. |C| has the same dynamics as
% |pid_sys|, but stores the dynamic parameters as transfer-function numerator
% and denominator coefficients instead of proportional, integral, and derivative
% gains. 

%%
% You can similarly convert transfer function models to |pid| models, provided
% the |tf| model object represents a parallel-form PID controller with
% $T_f \ge 0$.  

%% 
% In general, you can use the technique of this example to convert any type
% of model to another type of model. For more specific information about
% converting to a particular model type, see the reference page for that
% model type.