www.gusucode.com > robust 案例源码程序 matlab代码 > robust/CreatingUncertainParametersExample.m
%% Creating Uncertain Parameters % An uncertain parameter has a name (used to identify it within an % uncertain system with many uncertain parameters) and a nominal value. % Being uncertain, it also has variability, described in one of the % following ways: %% % % * An additive deviation from the nominal % * A range about the nominal % * A percentage deviation from the nominal % %% % Create a real parameter, with name '|bw|', nominal % value 5, and a percentage uncertainty of 10%. % Copyright 2015 The MathWorks, Inc. bw = ureal('bw',5,'Percentage',10) %% % This command creates a |ureal| object that stores a number of parameters % in its properties. View the properties of |bw|. get(bw) %% % Note that the range of variation (|Range| property) % and the additive deviation from nominal (the |PlusMinus| property) % are consistent with the |Percentage| property value. % % You can create state-space and transfer function models with uncertain % real coefficients using |ureal| objects. The result is an % uncertain state-space (|uss|) object. As an example, use the uncertain real parameter % |bw| to model a first-order system whose bandwidth is between 4.5 and 5.5 % rad/s. H = tf(1,[1/bw 1]) %% % Note that the result |H| is an uncertain system, % called a |uss| model. The nominal % value of |H| is a state-space (|ss|) model. Verify that % the pole is at -5, as expected from the uncertain parameter's nominal value of 5. pole(H.NominalValue) %% % Next, use |bodeplot| and |stepplot| to examine % the behavior of |H|. These commands plot the responses % of the nominal system and a number of random samples of the uncertain system. bodeplot(H,{1e-1 1e2}); %% stepplot(H) %% % While there are variations in the bandwidth and time constant of |H|, the % high-frequency rolls off at 20 dB/decade regardless of the value of |bw|. % You can capture the more complicated uncertain behavior that typically % occurs at high frequencies using the |ultidyn| uncertain element.