LAB Session of Robotics and Automation1
LAB Session of Robotics and Automation1
MATLAB
Experiment No. 12
To represent LTI system in MATLAB with respect to SISO and MIMO systems
Objectives:
This experiment has following two objectives:
We will learn commands in MATLAB that would be used to represent such systems in
terms of transfer function or pole-zero gain representations.
We will also learn how to make preliminary analysis of such systems using plots of
poles and zeros locations as well as time response due to impulse, step and arbitrary
inputs.
List of Equipment/Software:
Following equipment/software is required:
MATLAB
Deliverables:
Observations and solutions to exercises provided at the end.
Oral verification of results
Linear Time-Invariant Systems in MATLAB:
Control System Toolbox in MATLAB offers extensive tools to manipulate and analyze
linear time-invariant (LTI) models. It supports both continuous-and discrete-time systems.
Systems can be single-input/single-output (SISO) or multiple-input/multiple-output
(MIMO).
Examples of Creating LTI Models:
Building LTI models with Control System Toolbox is straightforward. The following
sections show simple examples. Note that all LTI models, i.e. TF, ZPK and SS are also
MATLAB objects.
Example of Creating Transfer Function Models:
You can create transfer function (TF) models by specifying numerator and denominator
coefficients. For example,
C/R = s / (s2+2s+1)
>>num = [1 0];
>>den = [1 2 1];
>>sys = tf(num,den)
Transfer function:
>>s=tf('s');
Transfer function:
Consider,
M1=15, M2=14
fv1=fv2=fv3= 1
K1=K2=K3=2
To create zero-pole-gain (ZPK) models, you must specify each of the three components in
vector format. For example,
>>sys = zpk([0],[-1 -1],[1])
Zero/pole/gain:
produces the same transfer function built in the TF example, but the representation is now
ZPK.
This example shows a more complicated ZPK model.
Zero/pole/gain:
pzmap:
Compute pole-zero map of LTI models.
Pzmap(sys)
Consider; C/R=H=(2s2+5s+1)/(s2+2s+3)
pzmap(sys1,sys2,…,sysN)
Description:
pzmap(sys1,sys2,…,sysN) plots the pole-zero map of several LTI models on a single figure.
The LTI models can have different numbers of inputs and outputs.
Consider; C/R=H=(2s2+5s+1)/(s2+2s+3)
C/R=L=(s+1)/(3s2+5s+7)
Description:
When invoked with left-hand arguments, [p,z] = pzmap(sys) returns the system poles and
zeros in the column vectors p and z. No plot is drawn on the screen.
You can simulate the LTI systems to inputs like impulse, step and other standard inputs
and see the plot of the response in the figure window. MATLAB command ‘impulse’
calculates the unit impulse response of the system, ‘step’ calculates the unit step
response of the system.
Step Response:
>>step(H)
To contain the response of the system you can also specify the time interval to simulate the
system. For example,
You can use the right-click menu for rlocus to add grid lines, zoom in or out, and invoke the
Property Editor to customize the plot. Also, click anywhere on the curve to activate a data
marker that displays the gain value, pole, damping, overshoot, and frequency at the selected
point.
Time-Domain Characteristics:
The following MATLAB command is used to find the rise time, settling time, peak time, and
percent overshoot, etc.
2021-me-427 Hassan Zahid
>>S = stepinfo(sys)
S = stepinfo(sys)computes the step-response characteristics for a dynamic system model sys.
The function returns the characteristics in a structure containing the fields:
RiseTime — Time it takes for the response to rise from 10% to 90% of the steady-
state response.
SettlingTime — Time it takes for the error |y(t) - yfinal| between the response y(t) and
the steady-state response yfinal to fall to within 2% of yfinal.
Undershoot — Percentage undershoot.
Peak — Peak absolute value of y(t)
PeakTime — Time at which the peak value occurs.
Example:
Recall system ‘h’ again and computes all above.
A marker appears on the plot indicating the peak response. Horizontal and vertical dotted
lines indicate the time and amplitude of that response.
Click the marker to view the value of the peak response and the overshoot in a datatip.