Professional Documents
Culture Documents
MO DELING
Extras: Generating a Step Response
ANALYSIS in MATLAB
step(sys)
SIMULINK
MO DELING
Contents
C O NTR O L
Changing the magnitude of the step
combination. Most systems you will come across in the beginning will
be SISO or Single-Input, Single-Output. In this case, there will be only
can derive the transfer function shown below. You wish to see what
the system response to unit step input is (an applied force of 1N). To
model this, enter the following code into a new m-file. Running this
script in the MATLAB command window will generate a plot like the
M = 1; % units of kg
M = 1; % units of kg
K = 10; % units of N/m
B = 2; % units of N-s/m
num = 1;
den = [M B K];
sys = tf(num,den)
step(sys);
sys =
--------------
s^2 + 2 s + 10
This figure shows the output response, which is the position of the
mass. You can see that in steady-state the mass has moved 0.1
meters (the spring force balances the applied force). The system is
Further details regarding the use of the step command for more
So far, we have only dealt with unit step inputs. Suppose the input to
our system was not 1 Newton, but in fact 100 Newtons. The step
(since we are only dealing with linear systems). For the example
above, this is achieved with the following code, which generates the
step(100*sys);
The plot looks similar to the one above it except that it has been
The step response for any LTI object can be plotted with a user-
supplied time vector. This vector will specify the time interval over
specified time vector can be supplied via the second input to the
function as shown below.
step(sys,t);
In the above two plots, only the first 6 seconds of the response are
In the above two plots, only the first 6 seconds of the response are
time vector can be created to compute the step response over this
range. Adding the following commands to your m-file and running will
generate the figure shown below.
t=0:0.1:10;
step(sys,t);
The final note about the step command is that all of the above
[y,t] = step(sys);
or
[y,t] = step(sys,t);
[y,t,x] = step(sys);
called. You will usually want to put a semicolon after the step
MATLAB will print out the entire output, state, and time vectors to the
command window. You can plot the output response using
following example.
num = 1;
den = [1 0.5];
Ts = 0.1;
sys = tf(num,den,Ts)
step(sys)
sys =
-------
z + 0.5