Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

LAB # 01

INTRODUCTION TO CONTROL SYSTEMS


SUBMITTED BY: Talha Arshad

SUBJECT: Control Systems Lab (EE-323)

DATE OF SUBMISSION: February 25, 2021

INTRODUCTION AND OBJECTIVE OF LAB:


This lab is related to an introduction to MATLAB in the first part. The lab also
provides information on polynomials, scriptwriting, and programming aspect of
MATLAB from a control systems viewpoint. This lab involves the following main
terms.
 Variables
 Vectors
 Arrays
 Plotting

UNDERLYING OR BACKGROUND THEORY:


In this lab, we used many commands and techniques to solve a problem in MATLAB. As this
is an introductory lab and our command is on a basic level. We also used scripting in
MATLAB how we plot an equation and build a graph.

Variables:

Variables are special characters and words and underscore (_) used in MATLAB. Variables
are used to initialize something. Variables always start from letters not from words. i.e.

team= 45;

Vectors:

Vectors are the subset of Matrix. A vector is always either a row vector or a column vector.
Row vector can be initialized as.

A=[4 5:3 4];

And column vector as B=[4:7:9];

Matrix:

Matrix is the subset of arrays. Matrix has two dimensions multiple rows and columns. It
always starts from [ and ends]. Spaces or commas are used to separate elements in a row. e.i.
 A matrix having m by n

A= [5 6:5 5]; is a 2 by 2 matrix.


Arrays:-
Arrays are the collection of several values of the same type. We used an array for
addition, subtraction, multiplication, and division of an array by a scalar simply apply the
operations to all elements of the array. A matrix is also an array with two dimensions
rows and columns.

RESULTS AND DISCUSSIONS:

In this lab, we mainly work on different commands used in MATLAB solving different
functions like Vector, Matrix, Array, and how to plot a graph in MATLAB using plot
command.
First of all, we use commands of vector how we write the equation of vector in
MATLAB. We use the length(x) command to find the length of the vector. We also used
transpose command in vector and in matrices. To multiply two vectors, the A*B
command is used. In the second part, we discuss matrices we use the magic command to
draw a matrix whose sum is always the same. Eye command is used for diagonal matrix
identity, zeros command for one and zero matrices respectively. For the multiplication of
two matrixes, we used the command as
C=A*B;
At the third level, we used arrays command of multiplication, division, addition,
subtraction.
Arrays multiplication is slightly different from matrix multiplication. We use the array
command to add two matrices as a+b and for division a. /b and multiplication a.*b and
subtraction a-b. In multiplication and division in an array, we use a (.) symbol to
multiply and divide with each number.
The main part of this lab is the plotting command which is used to plot many equations
and signals. In this plot following equations. Z= 3+6j (1)
y = 6*x.^3 + 7*x.^2+5*x+10; (2)

The first equation depicts the complex equation and, in Fig. 1 which shows the real and
complex part of the equation. And in equation 2 is a polynomial equation and its order is
three. And in Fig. 2 we plot linear/linear scale which means that x and y both increase
linearly and for this purpose, we use the plot command. And, in Fig. 3 we plot log/linear
scale it means x is a logarithmic scale and y is a linear scale. For this purpose, we use the
command semilogx. And we see that curve start increasing from beyond 10’s power zero i.e
from 1. In Fig. 4 we plot linear/log scale which means x is linear scale while y is a
logarithmic scale and we use the semilogy command. The graph shows that at x=0 the
function is 10's power 1 and, then starts increasing linearly. In Fig. 5 we plot the log/log scale
which means both x and y are a logarithmic scale. And we use the command loglog to plot
this relation. This figure shows that the graph starts to form at 10's power -1 at x scale and at
y scale it is 10's power 1. And then gradually starts increasing. And we say that these all
graphs show logarithmic behavior.

You might also like