www.gusucode.com > control 案例程序 matlab源码代码 > control/EvaluateRequirementsForTunedSystemExample.m

    %% Evaluate Requirements for Tuned System
% Tune a control system with |systune| , and evaluate the tuning requirements with |evalSpec|.
%% 
% Open the Simulink(R) model |rct_airframe2|. 
open_system('rct_airframe2')
%%
% Create tracking, roll-off, stability margin, and disturbance rejection
% requirements for tuning the control system.
Req1 = TuningGoal.Tracking('az ref','az',1);                 
Req2 = TuningGoal.Gain('delta fin','delta fin',tf(25,[1 0])); 
Req3 = TuningGoal.Margins('delta fin',7,45);                  
MaxGain = frd([2 200 200],[0.02 2 200]);
Req4 = TuningGoal.Gain('delta fin','az',MaxGain);  
%%
% Create an |slTuner| interface and tune the model using these tuning requirements.
ST0 = slTuner('rct_airframe2','MIMO Controller');
rng default
[ST1,fSoft] = systune(ST0,[Req1,Req2,Req3,Req4]);
%%
% |ST1| is a tuned version of the |slTuner| interface
% to the control system. |ST1| contains the tuned values
% of the tunable parameters of the MIMO controller in the model. 
%%
% Evaluate the margin requirement for the tuned system.
[hspec,fval] = evalSpec(Req3,ST1);
fval
%%
% The normalized value of the requirement is less than 1, indicating that the
% tuned system satisfies the margin requirement. For more information about
% how the normalized value of this requirement is calculated, see the
% |TuningGoal.Margins| reference page.
%%
% Evaluate the tracking requirement for the tuned system.
[hspec,fval] = evalSpec(Req1,ST1);
fval
%% 
% The tracking requirement is nearly met, but the value exceeds 1,
% indicating a small violation. To further assess the violation, you can
% use |viewSpec| to examine the requirement against the
% tuned control system as a function of frequency.