www.gusucode.com > control_featured 案例源码程序 matlab代码 > control_featured/sisoinitdemo.m
%% Programmatically Initializing the Control System Designer % This example shows how to configure Control System Designer from the % command line and how to create functions to customize the startup of a % Control System Designer session. % % Copyright 1986-2012 The MathWorks, Inc. %% Control System Designer Configurations % Control System Designer has six available feedback control system % configurations: % % 1) Standard feedback loop with the compensator in the forward path and a % prefilter. % % 2) Standard feedback loop with the compensator in the feedback path and a % prefilter. % % 3) Feedforward compensation and a feedback loop with a compensator in the % forward path. This configuration is often used to attenuate disturbances % that can be measured before they act on the system. % % 4) Nested multiloop design configuration. This configuration provides the % ability to separate the design into steps by isolating portions of the % control loops. % % 5) The standard Internal Model Control (IMC) structure. % % 6) Cascaded multiloop design configuration. This configuration provides the % ability to separate the design into steps by isolating portions of the % control loops. % % <<../sisoinitconfig.png>> % %% % By default, Control System Designer is initialized with configuration 1. % You can change this within the app. Alternatively, you can initialize % Control System Designer from command line. %% Initialize Control System Designer % For this example, create a design initialization structure with the % following settings: %% % * Feedback configuration 4 % * Plant |G| with a value of tf(1,[1,1]) % * Root locus and bode editors for the outer open-loop % * Nichols editor for the inner open-loop %% % Create a design initialization structure for configuration 4 using the % |sisoinit| command. s = sisoinit(4) %% % In the initialization structure, |s|, the system model components are: % % * Outer-loop compensator - |C1| % * Inner-loop compensator - |C2| % * Plant dynamics - |G| % * Sensor dynamics - |H| %% % The loop editor configurations for the system are: % % * Outer loop - OL1 % * Inner loop - OL2 % %% % Specify the value of the plant. s.G.Value = tf(1,[1,1]); %% % Specify the editors to use for each open loop andmeaningful loop names. s.OL1.Name = 'Outer Loop'; s.OL1.View = {'rlocus','bode'}; s.OL2.Name = 'Inner Loop'; s.OL2.View = {'nichols'}; %% % Open Control System Designer using the initialization structure. % % controlSystemDesigner(s) % %% % <<../sisoinitControlSystemDesigner.png>> %% Create Custom Initialization Function % % Creating a custom initialization function is useful to start Control % System Designer in a configuration that you used often. For example, the % following initialization function creates an initialization structure % using specified plant dynamics. %% % % <include>mycustomcontrolsysdesignerfcn.m</include> % %% % To pen Control System Designer using this function, enter: % % mycustomcontrolsysdesignerfcn(G) %