www.gusucode.com > control_featured 案例源码程序 matlab代码 > control_featured/MultiModelPlantdemo.m
%% Compensator Design for a Set of Plant Models % This example shows how to design and analyze a controller for multiple % plant models using Control System Designer. % Copyright 2010 The MathWorks, Inc. %% Acquiring a Set of Plant Models % For a typical feedback problem, the controller, |C|, is designed to % satisfy some performance objective. % % <<../MultiModelPlantDemoFigures_01.png>> % % Typically, the dynamics of the plant, |G|, are not kownown exactly and % can vary based on operating conditions. For example, the system dynamics % can vary: % % * Due to manufacturing tolerances that are typically defined as a range % about the nominal value. For example, resistors have a specified % tolerance range, such as 5 ohms +/- 1%) . % % * Operating conditions. For example, aircraft dynamics change based on % altitude and speed. % % When designing controllers for these types of systems, the performance % objectives must be satisfied for all variations of the system. % % You can model such systems as a set of LTI models stored in an LTI array. % You can then use Control System Designer to design a controller for a % nominal plant from the array and analyze the controller design for the % entire set of plants. % % The following list shows commands for creating an array of LTI models: % % Control System Toolbox(TM): % % * Functions: <matlab:doc('stack') stack>, <matlab:doc('tf') tf>, <matlab:doc('zpk') zpk>, <matlab:doc('ss') ss>, <matlab:doc('frd') frd> % % Simulink(R) Control Design(TM): % % * Functions: <matlab:doc('frestimate') frestimate>, <matlab:doc('linearize') linearize> % * Example: <docid:slcontrol_examples.example-scddcmotorpad>. % % Robust Control Toolbox(TM): % % * Functions: <matlab:doc('uss') uss>, <matlab:doc('usample') usample>, <matlab:doc('usubs') usubs>. % % System Identification Toolbox(TM): % % * Functions: <matlab:doc('pem') pem>, <matlab:doc('oe') oe>, <matlab:doc('arx') arx>. % %% Create LTI Array % In this example, the plant model is the second-order system: % % $$ G(s) = \frac{\omega_n^2}{s^2 +2\zeta\omega_n s+\omega_n^2} $$ % % where % % $$ \omega_n = (1,1.5,2) $$ and $$ \zeta = (.2,.5,.8) $$. % %% % Construct an LTI array for the combinations of $\zeta$ and $\omega_n$. wn = [1,1.5,2]; zeta = [.2,.5,.8]; ct = 1; for ct1 = 1:length(wn) for ct2 = 1:length(zeta) zetai = zeta(ct2); wni = wn(ct1); G(1,1,ct) = tf(wni^2,[1,2*zetai*wni,wni^2]); ct = ct+1; end end size(G) %% Open Control System Designer % Start the Control System Designer. % % controlSystemDesigner(G) % % <<../MultiModelPlantDemoFigures_02.png>> % % The app opens with Bode and root locus open-loop editors open along with % a step response plot. % %% % By default, the nominal model used for design is the first element in the % LTI array. % % * The root locus editor displays the root locus for the nominal model and % the closed-loop pole locations associated with the set of plants. % % * The Bode editor displays both the nominal model response and responses % of the set of plants. % % Using these editors, you can interactively tune the gain, poles, and % zeros of the compensator, while simultaneously visualizing the effect on % the set of plants. %% Change the Nominal Model % To change the nominal model, in the app, click *Multimodel Configuration*. % % <<../MultiModelPlantDemoFigures_03.png>> % %% % To select the fifth model in the array as the nominal model, in the % Multimodel Configuration dialog box, set the *Nominal Model Index* to % |5|. The app response plots update automatically. % % <<../MultiModelPlantDemoFigures_04.png>> % %% Options for Plotting Responses % The response plots always show the response of the nominal model. To view % the other model responses, right-click the plot area and select: % % * *Multimodel Display > Individual Responses* to view the response % for each model. % * *Multimodel Display > Bounds* to view an envelope that encapsulates all of the responses. % % <<../MultiModelPlantDemoFigures_05.png>> %