%% Decompose Model into Fast and Slow Dynamics
% Load a dynamic system model.

load numdemo Pd
bode(Pd)

%
% Pd has four complex poles and one real pole. The Bode plot shows a resonance around 210 rad/s and a higher-frequency resonance below 10,000 rad/s.
% Decompose this model around 1000 rad/s to separate these two resonances.

[Gs,Gf] = freqsep(Pd,10^3);
bode(Pd,Gs,Gf)
legend('original','slow','fast','Location','Southwest')

% The Bode plot shows that the slow component, Gs, contains only the lower-frequency resonance. This component also matches the DC gain of the original model. The fast component, Gf, contains the higher-frequency resonances and matches the response of the original model at high frequencies. The sum of the two components Gs+Gf yields the original model.
% Copyright 2015 The MathWorks, Inc.