%% Transfer Function with Uncertain Coefficients
% Create a second-order transfer function with uncertain natural frequency and damping coefficient.

w0 = ureal('w0',10);
zeta = ureal('zeta',0.7,'Range',[0.6,0.8]);

usys = tf(w0^2,[1 2*zeta*w0 w0^2])

%
% usys is an uncertain state-space (uss) model with two Control Design Blocks. The uncertain real parameter w0 occurs five times in the transfer function, twice in the numerator and three times in the denominator. To reduce the number of occurrences, you can rewrite the transfer function by dividing numerator and denominator by w0^2.

usys = tf(1,[1/w0^2 2*zeta/w0 1])

% In the new formulation, there are only three occurrences of the uncertain parameter w0. Reducing the number of occurrences of a Control Design Block in a model can improve the performance of calculations involving the model.
%
% Examine the step response of the system to get a sense of the range of responses that the uncertainty represents.

step(usys)

% When you use linear analysis commands like step and bode to create response plots of uncertain systems, they automatically plot random samples of the system. While these samples give you a sense of the range of responses that fall within the uncertainty, they do not necessarily include the worst-case response. To analyze worst-case responses of uncertain systems, use wcgain or wcsigmaplot.
% Copyright 2012 The MathWorks, Inc.