You are on page 1of 14

Control Systems

LAB 1
Linear Control System

University of Engineering and Technology,


Lahore New Campus

Submitted To: Dr. Haris Awan


Date: 22 – 10 – 2020
Submitted By:
2017 – BME – 16
2017 – BME – 22
2017 – BME – 38
2017 – BME – 48
Lab 1
Experiment 1: Using MATLAB for Control Systems
Objectives: This lab provides an introduction to MATLAB in the first part. The lab also
provides tutorial of polynomials, script writing and programming aspect of MATLAB from
control systems view point.
List of Equipment/Software
Following equipment/software is required:
• MATLAB
Category Soft-Experiment
Deliverables
A complete lab report including the following:
• Summarized learning outcomes.
• MATLAB scripts and their results should be reported properly.
Vectors:
A row vector in MATLAB can be created by an explicit list, starting with a left bracket,
entering the values separated by spaces (or commas) and closing the vector with a right
bracket.
◼ A column vector can be created the same way, and the rows are separated by semicolons
➢ create row vector x starting with start, counting by one, ending at end

➢ create row vector x starting with start, ending at end, having number elements

➢ returns the length of vector x

➢ transpose of vector x

➢ returns the scalar dot product of the vector x and y


Matrices:
A Matrix array is two-dimensional, having both multiple rows and multiple columns,
similar to vector arrays:
▪ it begins with [, and end with]
▪ spaces or commas are used to separate elements in a row
▪ semicolon or enter is used to separate rows
It generates a matrix whose elements are such that the sum of all elements in
its rows, columns and diagonal elements are same
Array Operations:
Scalar-Array Mathematics
For addition, subtraction, multiplication, and division of an array by a
scalar simply apply the operations to all elements of the array.
Plotting:

Exercise 1:
Use MATLAB command to obtain the following
a) Extract the fourth row of the matrix generated by magic (6)
b) Show the results of ‘x’ multiply by ‘y’ and ‘y’ divides by ‘x’.
Given x = [0:0.1:1.1] and y = [10:21]

c) Generate random matrix ‘r’ of size 4 by 5 with number varying between -8 and 9
Exercise 2:
Use MATLAB commands to get exactly as the figure shown below
x=pi/2:pi/10:2*pi;
y=sin(x);
z=cos(x);
Part II: Polynomials in MATLAB
Objective: The objective of this session is to learn how to represent polynomials in
MATLAB, find roots of polynomials, create polynomials when roots are known and obtain
partial fractions.
Convolution: De-convocation:
Exercise 1:
Consider the two polynomials ( ) and ( ) . Using
MATLAB compute
a. p(s )*q (s )
b. Roots of p(s ) and q(s )
c. p(-1 ) and q(6 )

You might also like