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

    %% Balanced Realization of Stable System
%%
% Consider the following zero-pole-gain model, with near-canceling
% pole-zero pairs:

% Copyright 2015 The MathWorks, Inc.

sys = zpk([-10 -20.01],[-5 -9.9 -20.1],1)
%%
% A state-space realization with balanced gramians is obtained by
[sysb,g] = balreal(sys);
%%
% The diagonal entries of the joint gramian are
g'
%%
% This indicates that the last two states of |sysb| are weakly coupled to
% the input and output. You can then delete these states by
sysr = modred(sysb,[2 3],'del');
%% 
% This yields the following first-order approximation of the original
% system.
zpk(sysr)
%%
% Compare the Bode responses of the original and reduced-order models.
bodeplot(sys,sysr,'r--')
%%
% The plots shows that removing the second and third states does not have
% much effect on system dynamics.