www.gusucode.com > control 案例程序 matlab源码代码 > control/TransRespRequirWithSpecInputTypeAndTolExample.m
%% Transient Response Requirement with Specified Input Type and Tolerance % Create a requirement for the transient response from a signal named |'r'| to % a signal named |'u'|. Constrain the impulse response % to match the response of transfer function $refsys = 1/(s+1)$, % but allow 20% relative variation between the target and tuned responses. %% refsys = tf(1,[1 1]); Req1 = TuningGoal.Transient('r','u',refsys); %% % When you do not specify a response type, the requirement constrains the % transient response. By default, the requirement allows a relative gap of % 0.1 between the target and tuned responses. To change the relative gap % to 20%, set the |RelGap| property of the requirement. Req1.RelGap = 0.2; %% % Examine the requirement. viewSpec(Req1) %% % The dashed line shows the target impulse response specified by this % requirement. You can use this requirement to tune a control system % model, |T|, that contains valid input and output % locations named |'r'| and |'u'|. If you % do so, the command |viewSpec(Req1,T)| plots the achieved % impulse response from |'r'| to |'u'| for % comparison to the target response. %% % Create a requirement that constrains the response to a step input, % instead of the impulse response. Req2 = TuningGoal.Transient('r','u',refsys,'step'); %% % Examine this requirement. viewSpec(Req2) %% % |Req2| is equivalent to the following step tracking requirement: Req3 = TuningGoal.StepTracking('r','u',refsys);