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

    %% Convert Transfer Function to State-Space Model
% Compute the state-space model of the following transfer function:
%
% $$H\left( s \right) = \left[ {\begin{array}{*{20}{c}}
% {\frac{{s + 1}}{{{s^3} + 3{s^2} + 3s + 2}}}\\
% {\frac{{{s^2} + 3}}{{{s^2} + s + 1}}}
% \end{array}} \right]$$
%

%%
% Create the transfer function model.
H = [tf([1 1],[1 3 3 2]) ; tf([1 0 3],[1 1 1])];

%%
% Convert this model to a state-space model.
sys = ss(H);

%%
% Examine the size of the state-space model.
size(sys)

%%
% The number of states is equal to the cumulative order of the SISO entries
% in _H_(_s_).

%%
% To obtain a minimal realization of _H_(_s_), enter
sys = ss(H,'minimal');
size(sys)

%%
% The resulting model has an order of three, which is the minimum number of
% states needed to represent _H_(_s_). To see this number of states,
% refactor _H_(_s_) as the product of a first-order system and a
% second-order system.
%
% $$H(s) = \left[ {\begin{array}{*{20}{c}}
% {\frac{1}{{s + 2}}}&0\\
% 0&1
% \end{array}} \right]\left[ {\begin{array}{*{20}{c}}
% {\frac{{s + 1}}{{{s^2} + s + 1}}}\\
% {\frac{{{s^2} + 3}}{{{s^2} + s + 1}}}
% \end{array}} \right]$$
%