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

    %% Constrain Transient Response to Custom Input Signal
% Create a requirement for the transient response from |'r'| to |'u'|.
% Constrain the response to a sinusoidal input signal, rather than to an
% input, step, or ramp. 
%%
% To specify a custom input signal, set the input filter to the Laplace
% transform of the desired signal.  For example, suppose you want to
% constrain the response to a signal of $\sin{\omega t}$. The Laplace
% transform of this signal is given by:
%%
% 
% $$\mathrm{inputfilter} = \frac{\omega}{s^2 + \omega^{2}}.$$
% 
%% 
% Create a requirement that constrains the response at |'u'| to a sinusoidal input of
% natural frequency 2 rad/s at |'r'|.  The response should match that of
% the reference system  $refsys = 1/(s+1)$.
refsys = tf(1,[1 1]);
w = 2;
inputfilter = tf(w,[1 0 w^2]);
Req = TuningGoal.Transient('u','r',refsys,inputfilter);
%%
% Examine the requirement to see the shape of the target response.
viewSpec(Req)