Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

AMERICAN INTERNATIONAL

UNIVERSITY-BANGLADESH
Faculty of Engineering

Lab Report Title: Introduction to design and simulation of open loop and close loop control systems using a
Computer Aided Design (CAD) tool---MATLAB.
Lab Report No: 03 Date of Submission: 6 March 2021
Course Title: Modern control systems lab
Course Code: EEE4102 Section: E
Semester: Spring 2020-21 Course Teacher: Bishwajit Banik Pathik

Declaration and Statement of Authorship:


1. I/we hold a copy of this Assignment/Case-Study, which can be produced if the original is lost/damaged.
2. This Assignment/Case-Study is my/our original work and no part of it has been copied from any other student’s work or from any other source
except where due acknowledgement is made.
3. No part of this Assignment/Case-Study has been written for me/us by any other person except where such collaboration has been
authorized by the concerned teacher and is clearly acknowledged in the assignment.
4. I/we have not previously submitted or currently submitting this work for any other course/unit.
5. This work may be reproduced, communicated, compared and archived for the purpose of detecting plagiarism.
6. I/we give permission for a copy of my/our marked work to be retained by the Faculty for review and comparison, including review by
external examiners.
7. I/we understand that Plagiarism is the presentation of the work, idea or creation of another person as though it is your own. It is a
formofcheatingandisaveryseriousacademicoffencethatmayleadtoexpulsionfromtheUniversity. Plagiarized material can be drawn from, and
presented in, written, graphic and visual form, including electronic data, and oral presentations. Plagiarism occurs when the origin of them
arterial used is not appropriately cited.
8. I/we also understand that enabling plagiarism is the act of assisting or allowing another person to plagiarize or to copy my/our work.

* Student(s) must complete all details except the faculty use part.
** Please submit all assignments to your course teacher or the office of the concerned teacher.

Submitted by:

No Name ID Program Signature


1 Mohammad Bony Israil 19-39873-1 BSc [EEE]

Faculty use only


FACULTYCOMMENTS

Marks Obtained

Total Marks

© Dept. of EEE & COE, FE, AMERICAN INTERNATIONAL UNIVERSITY-BANGLADESH (AIUB)


PART 1:

%Creating equations, Calculating roots, Outputting transfer functions etc.


clc; %Clears the MATLAB Command Window
close all; %Closes all figures
clear all; %Clears all variables
p1=[3 9 8 7 3] %Defines the coefficients of a linear equation
printsys(p1,[3 9 8 7 3],'s') %Outputs the polynomial of the equation
%as a transfer function and also in
%symbolic form, where the variable
%is labelled as "s"
polyval(p1,1) %Evaluates the polynomial of the equation
%with a value of 1
r1=roots(p1) %Calculates the roots of the equation
p2=poly(r1) %Creates an equation from the roots (r1).
%This should match with the original equation(p1).
%But it will not match exactly in this case.
%This is because the imaginary portion of the
%complex root has fractions and MATLAB cannot
%incorporate all digits to the right of a
%fraction in computations.
printsys(p2,[3 9 8 7 3],'s') %Outputs the equation as a transfer function
%and also in symbolic form, where the variable
%is labelled as "s". This should match with
%the previous transfer function

OUTPUT:

2
PART 2:

CODE:

exp1=[3 9 8 7 3]; %Define an expression called exp1


exp2=[3 9 8 7 3]; %Define an expression called exp2
exp=conv(exp1,exp2) %Multiply these two expresions and store the
%result in exp

OUTPUT:

© Dept. of EEE & COE, FE, AMERICAN INTERNATIONAL UNIVERSITY-BANGLADESH (AIUB)


PART 3:

CODE:
clear all; %Clears all variables (i.e. p1,r1,p2 etc.)
OL_TRF_num = [1 1] %Define the numerator of a transfer function
OL_TRF_den = conv([1 4], [1 6]) %Define the denominator of a transfer function
printsys(OL_TRF_num, OL_TRF_den, 's')
%Outputs the transfer function (open-loop) in
%symbolic form, where the variable is "s"
[y, x, t]=step(OL_TRF_num, OL_TRF_den);
%Simulate this system for a step input.It will
%store the simulation results in certain
%variables like y,x,t
figure (1) %Label the figure
plot(t, y) %Display the simulation in a 2-D plot
grid %Add gridlines in the figure
title('Unit step response for open loop') %Add a title to the figure
ylabel('y(t)') %Label y axis
xlabel('time in seconds') %Label x axis

OUTPUT:

4
PART 4:

CODE:
%Simulating a close loop control system
%This control system has unity feedback
clear all; %Clears all variables (i.e. p1,r1,p2,Gnum,
%Gden,y,x,t etc.)
G = [1 1] %Define the feedforward transfer function
H = conv([1 4], [1 6]) %Define the feedback transfer function
[CL_TRF_num, CL_TRF_den] = cloop(G, H)
%Form the resulting close-loop transfer function
printsys(CL_TRF_num, CL_TRF_den, 's')
%Outputs the transfer function (open-loop) in
%symbolic form where the variable is "s"
[y, x, t]=step(CL_TRF_num, CL_TRF_den);
%Simulate this system for a step input.It will
%store the simulation results in certain
%variables like y,x,t
figure (2) %Label the figure
plot(t, y) %Display the simulation in a 2-D plot
grid %Add gridlines in the figure
title('Unit step responce for close loop') %Add a title to the figure
ylabel('y(t)') %Label y axis
xlabel('time in seconds') %Label x axis

OUTPUT:

© Dept. of EEE & COE, FE, AMERICAN INTERNATIONAL UNIVERSITY-BANGLADESH (AIUB)


DISCUSSION:

In this experiment we came to know about the use CAD tool-MATLAB and also how it could be used to
describe control system functions. We have learnt Creating polynomial functions, finding roots of a
polynomial function, evaluating polynomials, calculating product of two polynomial functions in
MATLAB. We have obtained transfer functions and step responses of open-loop and closed-loop control
systems. Our faculty helps us a lot to learn all of these and also gave us solutions which we have faced
during the experiment. Overall, the experiment is enough to understand about MATLAB.

You might also like