Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
15 views

LAB Session of Robotics and Automation1

This document outlines a MATLAB experiment focused on representing Linear Time-Invariant (LTI) systems, including Single-Input/Single-Output (SISO) and Multiple-Input/Multiple-Output (MIMO) systems. It details objectives such as learning MATLAB commands for system representation and analysis, as well as simulation of system responses to various inputs. Additionally, it covers stability analysis, steady-state errors, and root locus plotting for control systems using specific MATLAB commands.

Uploaded by

hassanzahid45
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views

LAB Session of Robotics and Automation1

This document outlines a MATLAB experiment focused on representing Linear Time-Invariant (LTI) systems, including Single-Input/Single-Output (SISO) and Multiple-Input/Multiple-Output (MIMO) systems. It details objectives such as learning MATLAB commands for system representation and analysis, as well as simulation of system responses to various inputs. Additionally, it covers stability analysis, steady-state errors, and root locus plotting for control systems using specific MATLAB commands.

Uploaded by

hassanzahid45
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 12

SECTION-E

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:

2021-me-427 Hassan Zahid


A useful trick is to create the Laplace variable, s. That way, you can specify polynomials
using s as the polynomial variable.

>>s=tf('s');

>>sys= s/(s^2 + 2*s + 1)

Transfer function:

Transfer Function From Single Differential Equation:


By considering the right hand side of differential equation as numerator and left hand side of
differential equation as denominator, the transfer function can be determined as represented
below.
For example:

Suppose, M=5, fv=3, and K=1

2021-me-427 Hassan Zahid


Transfer function from Differential Equations:

Consider the following system:

Consider,
M1=15, M2=14
fv1=fv2=fv3= 1
K1=K2=K3=2

2021-me-427 Hassan Zahid


Example of Creating Zero-Pole-Gain Models:

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.

>>sys=zpk([1 0], [-1 -3 -.28],[.776])

Zero/pole/gain:

Plotting poles and zeros of a system:

pzmap:
Compute pole-zero map of LTI models.
Pzmap(sys)

2021-me-427 Hassan Zahid


Description:
pzmap(sys) plots the pole-zero map of the continuous- or discrete-time LTI model sys. For
SISO systems, pzmap plots the transfer function poles and zeros. The poles are plotted as x’s
and the zeros are plotted as o’s. You can use the functions sgrid or zgrid to plot lines of
constant damping ratio and natural frequency in the s- or z- plane.
Example:

Plot the poles and zeros of the continuous-time system.

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)

2021-me-427 Hassan Zahid


[p,z] = pzmap(sys)

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.

Simulation of Linear systems to different inputs:

impulse, step, ramp and parabolic response

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.

2021-me-427 Hassan Zahid


Impulse Response:
To obtain an impulse response

Step Response:
>>step(H)

2021-me-427 Hassan Zahid


Time-interval specification:

To contain the response of the system you can also specify the time interval to simulate the
system. For example,

2021-me-427 Hassan Zahid


Experiment No. 13
To find the stability of control and automation system, steady state errors and how to plot
their root locus.
Objective:
The objective of this lab session is to familiarize about the MATLAB commands used to find
the stability of control systems, steady state errors, and how to plot their root locus.
Stability of Control Systems:
The following MATLAB command is used to determine the stability of control systems.
>>B = isstable(sys)
B = isstable(sys) returns a logical value of 1 (true) if the dynamic system model sys has
stable dynamics, and a logical value of 0 (false) otherwise.
Example:
Determine the stability of the system shown in figure below.

Because the logical value is zero, therefore the system is unstable.


Steady-State Error:
The following MATLAB command is used to find the steady state error of the system.
>>SP=5; %input value, if you put 1 then is the same as step(sys)
>>[y,t]=step(SP*sys); %get the response of the system to a step with amplitude SP
>>sserror=abs(SP-y(end)) %get the steady state error
Example:
Find the steady state error for the above system.

2021-me-427 Hassan Zahid


Root-Locus:
The following MATLAB command is used to plot the root locus the system.
>>rlocus(sys)
rlocus(sys) calculates and plots the root locus of the open-loop SISO model sys. This
function can be applied to any of the following negative feedback loops by setting sys
appropriately.
Example:
Plot the root-locus of the following system.

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.

Time-Domain Characteristics on Response Plot:


This example shows how to display system characteristics such as settling time and
overshoot on step response plots.
You can use similar procedures to display system characteristics on impulse response plots
or initial value response plots, such as peak response or settling time.
Create a transfer function model and plot its response to a step input at t = 0.
Example:
>>H=tf([8 18 32],[1 6 14 24]);
>>stepplot(H)

2021-me-427 Hassan Zahid


Display the peak response on the plot.
Right-click anywhere in the figure and select Characteristics > Peak Response from the
menu.

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.

2021-me-427 Hassan Zahid

You might also like