www.gusucode.com > control 案例程序 matlab源码代码 > control/ApproximateDifferentDelaysWithDifferentApproximationOrdeExample.m
%% Approximate Different Delays with Different Approximation Orders % This example shows how to specify different Padé approximation % orders to approximate internal and output delays in a continuous-time % open-loop system. % %% % Load a sample continuous-time open-loop system that contains internal and % output time delays. % Copyright 2015 The MathWorks, Inc. load(fullfile(matlabroot,'examples','control','PadeApproximation1.mat'),'sys') sys %% % |sys| is a second-order continuous-time |ss| model with internal delay % 3.4 s and output delay 1.5 s. % % Use the |pade| function to compute a third-order approximation of the % internal delay and a first-order approximation of the output delay. P13 = pade(sys,inf,1,3); size(P13) %% % The three input arguments following |sys| specify % the approximation orders of any input, output, and internal delays % of |sys|, respectively. |inf| specifies % that a delay is not to be approximated. The approximation orders for % the output and internal delays are one and three respectively. %% % Approximating the time delays with |pade| absorbs delays into the % dynamics, adding as many states to the model as orders in the % approximation. Thus, |P13| is a sixth-order % model with no delays. %% % For comparison, approximate only the internal delay of |sys|, % leaving the output delay intact. P3 = pade(sys,inf,inf,3); size(P3) %% P3.OutputDelay %% P3.InternalDelay %% % |P3| retains the output delay, but the internal delay is approximated % and absorbed into the state-space matrices, resulting in a fifth-order model without internal delays. %% % Compare the frequency response of the exact and approximated systems % |sys|, |P13|, |P3|. h = bodeoptions; h.PhaseMatching = 'on'; bode(sys,'b-',P13,'r-.',P3,'k--',h,{.01,10}); legend('sys','approximated output and internal delays','approximated internal delay only',... 'location','SouthWest') %% % Notice that approximating the internal delay loses the gain ripple % displayed in the exact system.