0% found this document useful (0 votes)
18 views94 pages

CST - 3130905-Lab Manual - Winter-2002

This document is a laboratory manual for the Control System Theory course (3130905) for B.E. Semester 3 Electrical students at Vishwakarma Government Engineering College. It outlines the course objectives, prerequisites, outcomes, and practical experiments using MATLAB/SCILAB to enhance students' understanding of control systems. The manual emphasizes competency-based learning and provides guidelines for faculty and students to effectively conduct laboratory work.

Uploaded by

vgeckabalak
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views94 pages

CST - 3130905-Lab Manual - Winter-2002

This document is a laboratory manual for the Control System Theory course (3130905) for B.E. Semester 3 Electrical students at Vishwakarma Government Engineering College. It outlines the course objectives, prerequisites, outcomes, and practical experiments using MATLAB/SCILAB to enhance students' understanding of control systems. The manual emphasizes competency-based learning and provides guidelines for faculty and students to effectively conduct laboratory work.

Uploaded by

vgeckabalak
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 94

A Laboratory Manual for

CONTROL SYSTEM THEORY


(3130905)

B.E. Semester 3 (Electrical)

Directorate of Technical Education,


Gandhinagar, Gujarat
VISHWAKARMA GOVERNMENT ENGINEERING
COLLEGE CHANDKHEDA

Certificate

This is to certify that Mr./Ms. _________


Enrollment No. ____________of B.E. Semester III
Electrical Engineering of this Institute (GTU Code: 017) has satisfactorily
completed the Practical / Tutorial work for the subject Control System
Theory (3130905) for the academic year 2024-25.

Place:
Date:

Name and Sign of Faculty member

Head of the Department


Type of course: Modeling, performance analysis and control with potential application to

engineering systems.

Prerequisite: Knowledge of Linear algebra, Differential equations and Laplace transform.

Rationale: Automatic control of industrial processes is essential for increasing the


output and in turn the profit of an industry. As a result, most of the
companies are using automatic control of the machineries and processes. As
an engineer, a student must know the basics of automatic control system.
This subject is intended to supplement the basic skill of an engineer. This
course explores the fundamentals of systems and control. The course has
following primary focuses on:
(1) Understanding and predicting behavior of the system.
(2) Differentiate between the open loop and closed loop systems.
(3) Design and analysis of closed loop control systems.
(4) Analyze the condition for system stability.
(5) Understand different methods for finding the relative and
absolute stability of the system.
(6) Evaluate the performance of the system for different excitation.
.
Course Outcomes:

After learning the course, the students should be able to:

Sr. No. CO statement


CO-1 Understand the fundamental of feedback control system.

CO-2 Understand time response specifications and determine the (absolute)


stability of a closed-loop control system.
CO-3 Determine the time and frequency-domain responses of first and second-
order systems to step and other standard inputs.
CO-4 Design controller as per given specifications using different techniques.

CO-5 Express and solve system equations in state-variable form (state variable
models).

Lab Work: SCILAB/ MATLAB based assignments and simulations covering design,
analysis and modelling of control systems relevant tocurriculum.

Legends: R: Remembrance; U: Understanding; A: Application, N: Analyze and E:Evaluate


C:Create and above Levels (Revised Bloom’s Taxonomy) for assignment
Practical – Course Outcome matrix

Sr.
Objective(s) of Experiment CO1 CO2 CO3 CO4 CO5
No.
Using MATLAB plot the various
1. continuous graphs and perform open √
loop and close loop control system.
Using MATLAB plot the various step √
2. graphs.
To plot graph of some mathematical √
3. function like sin, cos, tan, Exponential.
To evaluate transfer function model √
4. using different methods.
To do block diagram reduction using √
5. MATLAB commands.
Reduce the block diagram using √
6. MATLAB function.
Using Simulink check Step function and

impulse function and verify with
7. MATLAB code. Also verify the
waveform for response of control
system using CRO.
To plot Root Locus of different system √
8. using MATLAB.
To plot bode plot using MATLAB
9. functions. Also verify the response for √
Compensators using CRO.
To perform PID controller using

10. MATLAB Simulink and verify its
response.
11 To obtain time response specifications and

time response of second order system.
12 To obtain transfer function from state

model and state model from transfer
function.
CONTROL SYSTEM ENGINEERING (3130905)

Preface

Main motto of any laboratory/practical/field work is for enhancing required skills as well as
creating ability amongst students to solve real time problem by developing relevant
competencies in psycho-motor domain. By keeping in view, GTU has designed competency
focused outcome-based curriculum for engineering degree programs where sufficient weightage
is given to practical work. It shows importance of enhancement of skills amongst the students
and it pays attention to utilize every second of time allotted for practical amongst students,
instructors and faculty members to achieve relevant outcomes by performing the experiments
rather than having merely study type experiments. It is must for effective implementation of
competency focused outcome-based curriculum that every practical is keenly designed to serve
as a tool to develop and enhance relevant competency required by the various industry among
every student. These psycho-motor skills are very difficult to develop through traditional chalk
and board content delivery method in the classroom. Accordingly, this lab manual is designed
to focus on the industry defined relevant outcomes, rather than old practice of conducting
practical to prove concept and theory.

By using this lab manual students can go through the relevant theory and procedure in advance
before the actual performance which creates an interest and students can have basic idea prior to
performance. This in turn enhances pre-determined outcomes amongst students. Each
experiment in this manual begins with competency, industry relevant skills, course outcomes as
well as practical outcomes (objectives). The students will also achieve safety and necessary
precautions to be taken while performing practical.

This manual also provides guidelines to faculty members to facilitate student centric lab
activities through each experiment by arranging and managing necessary resources. It also gives
an idea that how students will be assessed by providing rubrics.

Utmost care has been taken while preparing this lab manual along with assignments however
always there is chance of improvement. Therefore, we welcome constructive suggestions for
improvement and removal of errors if any. Also this is a suggested list of
Experiments/Assignments, faculty may modify & add as per the feasibility and the resources
available change & update in any part/program or else as per the requirement.
CONTROL SYSTEM ENGINEERING (3130905)

Practical – Course Outcome matrix


Sr. No. CO statement
CO-1 Analyze and Evaluate system behavior in time and frequency domains
Based on the mathematical model of the system.
CO-2 Apply control theory to linear system for system modeling using
Differential equations and transfer function realizations.
CO-3 Analyze and apply all the stability techniques for closed loopsystem performance
parameters.
CO-4 Comprehend the need of different types of controllers and compensators to obtain the
required dynamic response of the system.
CO-5 Synthesis system equations for state space models of linear systems.

Page Date of Date of Sign. of


Sr.
Objective(s) of Experiment No. performance submiss ion Teacher
No.
with
date
Using MATLAB plot the various continuous
1. graphs and perform open loop and close loop
controlsystem.

2. Using MATLAB plot the various step graphs.

To plot graph of some mathematical function


3.
like sin, cos, tan, Exponential.
To evaluate transfer function model using
4.
different methods.
To do block diagram reduction using
5.
MATLABcommands.
Reduce the block diagram using
6.
MATLABfunction.
Using Simulink check Step function and impulse
function and verify with MATLAB code. Also
7.
verify the waveform for response of control
system using CRO.
To plot Root Locus of different system using
8.
MATLAB.

9. To plot bode plot using MATLAB functions.

To perform PID controller using MATLAB


10.
Simulink and verify its response.
To obtain time response specifications and
11
time response of second order system.
To obtain transfer function from state model
12
and state model from transfer function
Experiment No: 0
Vision and Mission of DTE, Institute and Department

The Directorate of Technical Education, Education Department, Government of Gujarat


VISION
• To provide globally competitive technical education
• Remove geographical imbalances and inconsistencies
• Develop student friendly resources with a special focus on girls’ education and support to
weaker sections
• Develop programs relevant to industry and create a vibrant pool of technical professionals

Institute Vision & Mission Vision

Vision

• To create an ecosystem for proliferation of socially responsible and technically sound


engineers, innovators and entrepreneurs.

Mission
• To develop state-of-the-art laboratories and well-equipped academic infrastructure.
• To motivate faculty and staff for qualification up-gradation, and enhancement of subject
knowledge.
• To promote research, innovation and real life problem solving skills.
• To strengthen linkages with industries, academic and research organizations.
• To reinforce concern for sustainability, natural resource conservation and social
responsibility.

Department Vision & Mission

Vision

• To produce comprehensively trained, socially responsible and innovative electrical


graduates to contribute to the society.

Mission

• To develop well equipped laboratories and infrastructure for conducive learning.


• To produce competent and disciplined electrical engineers to serve the nation.
• To help in building national capabilities for excellent energy management and to explore
nonconventional energy sources.
• To produce electrical engineers with an attitude to adapt themselves to changing
technological environment.
• To enhance entrepreneurship skills through startup
Program Outcomes:
1. Engineering knowledge: Apply the knowledge of mathematics, science, engineering fundamentals, and

an engineering specialization to the solution of complex engineering problems.


2. Problem analysis: Identify, formulate, review research literature, and analyze complex engineering problems
reaching substantiated conclusions using first principles of mathematics, natural sciences, and engineering sciences.
3. Design/development of solutions: Design solutions for complex engineering problems and design
system components or processes that meet the specified needs with appropriate consideration for the public health
and safety, and the cultural, societal, and environmental considerations.
4. Conduct investigations of complex problems: Use research-based knowledge and research methods
including design of experiments, analysis and interpretation of data, and synthesis of the information to provide
valid conclusions.
5. Modern tool usage: Create, select, and apply appropriate techniques, resources, and modern engineering and IT
tools including prediction and modeling to complex engineering activities with an understanding of the limitations.
6. The engineer and society: Apply reasoning informed by the contextual knowledge to assess societal, health,
safety, legal and cultural issues and the consequent responsibilities relevant to the professional engineering practice.
7. Environment and sustainability: Understand the impact of the professional engineering solutions in
societal and environmental contexts, and demonstrate the knowledge of, and need for sustainable development.
8. Ethics: Apply ethical principles and commit to professional ethics and responsibilities and norms of the
engineering practice.
9. Individual and team work: Function effectively as an individual, and as a member or leader in diverse teams,
and in multidisciplinary settings.
10. Communication: Communicate effectively on complex engineering activities with the engineering community
and with society at large, such as, being able to comprehend and write effective reports and design documentation,
make effective presentations, and give and receive clear instructions.
11. Project management and finance: Demonstrate knowledge and understanding of the engineering
and management principles and apply these to one’s own work, as a member and leader in a team,
to manage projects and in multidisciplinaryenvironments.
12. Life-long learning: Recognize the need for, and have the preparation and ability to engage in independent and
life-long learning in the broadest context of technological change.
Program Educational Objectives
• Develop and conduct appropriate electrical experimentation, analyze and interpret data, and use
engineering judgment to draw conclusions.
• Acquire and apply new knowledge as needed, using appropriate learning strategies through innovation.
• Work independently on a project or as a team leader.

Program Specific Outcomes:

• Use various electrical testing tools and equipment’s in industry, be an Entrepreneur, Enroll in post-
graduate courses, Pursue Research and Innovation in the field of Electrical Engineering.
• Use knowledge of various electrical machines and electrical power system in solving complicated
electrical circuits and networks by using latest design and simulation tools.
• Use technical expertise and suggest modifications in existing electrical systems.
.
EXPERIMENT: - 1

AIM: - Using MATLAB plot the various graphs.

Relevant CO-CO1- Understand the fundamental of feedback control system.

MATLAB Functions: -
1. Plot: - Plot function can able to plot various graphs.
 The plot function takes two parameters, the first is X-axis values and the
second is Y-axis values.
 Plot function plot continuous graph.
 Function syntax: Plot(x, y)

2. Subplot: - subplot function can show more than 1 graph in the output window
at the same time.
 Subplot function takes three parameters, the first is number of rows the
second is number of columns and the third is graph number.
 Function syntax: subplot(rows, columns, no. of graph)

3. Xlabel: - xlable function shows title of X-axis.


 Function syntax: xlable(“title”)

4. Ylable: - ylable function shows title of Y-axis.


 Function syntax: ylable(“title”)

MATLAB code: -
n=-5:1:5;
y=(n==2)
subplot (3,1,1)
plot(n,y)
xlabel('t')
ylabel('u(t)')

n=0:0.5:10;
y=(n>=3)
subplot (3,1,2)
plot (n,y)
xlabel('t')
ylabel('u(t)')

n=0:1:10;
y=n;
subplot (3,1,3)
plot(n,y)
xlabel('x')
ylabel('y')

output: -

Date Sign Grade/Mark


EXPERIMENT: - 2

Aim: - Using MATLAB plot the various graphs.

Relevant CO-CO1- Understand the fundamental of feedback control system.

Stem: - stem function plots discrete graph.


 The stem function takes two parameters, the first is X-axis values and
the second is Y-axis values.
 Plot function plot discrete graph.
 Function syntax: stem (x, y)

MATLAB code: -
n=0:0.2:10;
y=(n==4);
subplot (3,1,1)
stem(n,y)
xlabel('t')
ylabel('u(t)')

n=0:0.2:10;
y=(n>=5);
subplot (3,1,2)
stem(n,y)
xlabel('t')
ylabel('u(t)')

n=-5:0.2:5;
y=n;
subplot (3,1,3)
stem(n,y)
xlabel('x')
ylabel('y')
Output: -

Date Sign Grade/Mark


EXPERIMENT: - 3

AIM: - To plot graph of some mathematical function like sin, cos, ten, Exponential.

Relevant CO-CO1- Understand the fundamental of feedback control system.

MATLAB functions: -
1. Trigonometric functions: - MATLAB support all trigonometric functions like
sin, cos, tan, cosec, sec, cot. These are takes suitable angle for print graph.
 Function syntax: sin(x), cos(x), ten(x), etc.

2. Exponential: - Exponential function takes only one parameter.


 Function syntax: exp(x)

3. Title: - Title functions will give title of the graph.


 Function syntax: title(“text”)

MATLAB code: -
t=0:0.2:20;
y =exp(t);
subplot (4,2,1);
plot(y,'r');
title('exponential');
subplot (4,2,2);
stem(y,'r');
title ('exponential discrete');

t=0:0.2:20;
y=sin(t);
subplot (4,2,3);
plot(y,'g');
title('sin');
subplot (4,2,4);
stem(y,'g');
title ('sine discrete');

t=0:0.2:20;
y=cos(t);
subplot (4,2,5);
plot(y,'b');
title('cos');
subplot (4,2,6);
stem(y,'b');
title ('cos discrete');

t=-1.5:0.1:1.5;
y=tan(t);
subplot (4,2,7);
plot(y,'y');
title('tan');
subplot (4,2,8);
stem(y,'y');
title ('tan discrete');

OUTPUT: -

Date Sign Grade/Mark


EXPERIMENT 4
Aim: - To evaluate transfer function model using different methods.

Relevant CO-CO1- Understand the fundamental of feedback control system.

MATLAB Functions: -
1. tf: - tf Construct transfer function or convert to transfer function.
 tf functions takes two parameters first one is array of numerator and
second is array of denominator. It is creates-continuous time transfer
function.
 Function syntax: sys = tf(num, den)
 sys = tf (num, den, ts) creates a discrete-time transfer function
with sample time ts (set ts =-1 if the sample time is undetermined).

2. tf2zpk: - this function returns value of zeros, poles, and gain of input transfer
function.
 Function syntax: [z, p, k] = tf2zpk (num, den)

3. zp2tf: - function zp2tf is use for conversion of zero, poles, and gain to transfer
function.
 Function syntax: [num, den] = zp2tf (z, p, k)

4. roots: - roots Find polynomial roots of the transfer function.


 Function syntax: val = roots(num)

5. Input: - input function take inputs from the user.


 Function syntax: x = input (‘enter the value of array:’)

6. pzmap: - pzmap computes the poles and zeros of the dynamic system and plots
them in the complex plane. The poles are plotted as x's and the zeros are plotted
as o's.
 Function syntax: pzmap (num, dem)
 [p, z] = pzmap(sys) returns the poles and zeros of the system in two
column vectors p and z. No plot is drawn on the screen.

Part A
Aim: - To get transfer function using tf function.
Input: -
num = input ('enter numerator')
den = input ('enter denotator')

sys = tf (num, den)

Output: -
enter numerator [ 4 5 6]

num =

4 5 6

enter denotator [ 8 3 4 2]

den =

8 3 4 2

sys =

4 s^2 + 5 s + 6

8 s^3 + 3 s^2 + 4 s + 2

Continuous-time transfer function.

Part B

Aim: - To get all zeros, poles, and gain value from the transfer function.

Input: -
num = input ('enter numerator')
den = input ('enter denotator')
sys = tf (num, den)
[z, p, k] = tf2zpk (num, den)

Output: -
enter numerator [ 2 3 6 1]

num =

2 3 6 1
enter denotator [ 1 5 9 6 3]

den =
1 5 9 6 3

sys =

2 s^3 + 3 s^2 + 6 s + 1

s^4 + 5 s^3 + 9 s^2 + 6 s + 3

Continuous-time transfer function.

z=

0.0000 + 0.0000i

-0.6595 + 1.5252i

-0.6595 - 1.5252i

-0.1811 + 0.0000i
p=

-2.1726 + 0.9491i

-2.1726 - 0.9491i

-0.3274 + 0.6531i

-0.3274 - 0.6531i

k=

Part C
Aim: - To get transfer function from the value of zeros, poles, and gain.
Input: -
z = input ('Enter the value of Zeros:')
p = input ('Enter the value of poles:')
k = input ('Enter the value of k:')
sys = tf (num, den)
rev = zpk (z, p, k)

Output: -
Enter the value of Zeros: [ 1 2 3]

z=
1 2 3
Enter the value of poles: [2 6 7 3]

p=
2 6 7 3

Enter the value of k:[2]

k=
2

sys =

2 s^3 + 3 s^2 + 6 s + 1

s^4 + 5 s^3 + 9 s^2 + 6 s + 3

Continuous-time transfer function.

rev =

2 (s-1) (s-2) (s-3)

(s-2) (s-3) (s-6) (s-7)

Continuous-time zero/pole/gain model.

Part D
Aim: - To find roots of the transfer function and print graph on pzmap.
Input: -
num = input ('enter numerator')
den = input ('enter denotator')
sys = tf (num, den)
poles = roots(den)
zeros = roots(num)
pzmap (num, den)

Output: -
enter numerator [ 26 35 22 20]

num =

26 35 22 20

enter denotator [11 25 36 34 40]


den =

11 25 36 34 40

sys =

26 s^3 + 35 s^2 + 22 s + 20
11 s^4 + 25 s^3 + 36 s^2 + 34 s + 40

Continuous-time transfer function.

poles =

-1.2680 + 0.9262i
-1.2680 - 0.9262i
0.1317 + 1.2073i
0.1317 - 1.2073i

zeros =

-1.1811 + 0.0000i
-0.0825 + 0.8028i
-0.0825 - 0.8028i

Date Sign Grade/Mark


EXPERIMENT 5
Aim: - To do block diagram reduction using MATLAB commands.

Relevant CO-CO1- Understand the fundamental of feedback control system.

MATLAB Function: -
1. Series: - series function can do Series connection of two input/output
models.
 Function syntax: M = series (M1, M2, OUTPUTS1, INPUTS2)

2. Conv: - conv Convolution and polynomial multiplication.


 Function syntax: C = conv (A, B)

3. Parallel: - parallel function can do Parallel connection of two


input/output models.
 Function syntax: M = parallel (M1, M2, IN1, IN2, OUT1,
OUT2)

4. Cloop: - cloop is obsolete, use FEEDBACK instead.

 Function syntax: [numcl, dencl] =cloop (num, den, -1);

5. Feedback: - Feedback connection of two input/output systems.

 Negative feedback is assumed and the model M maps u to y. To


apply positive feedback, use the syntax M = feedback (M1, M2,
+1)

 Function syntax: M = feedback (M1, M2,


FEEDIN,FEEDOUT,SIGN)

Part A
Aim: - use series function to reduce given block diagram.
Input:
num1 = input ('enter the value of numerator:')
den1 = input ('enter the value of denominator:')
num2 = input ('enter the value of numerator:')
den2 = input ('enter the value of denominator:')
[num12, den12] = series (num1, den1, num2, den2)
printsys (num12, den12);
Output:
enter the value of numerator: [1 0]
num1 =
1 0
enter the value of denominator: [9 17]
den1 =
9 17
enter the value of numerator:9*[1 3]
num2 =
9 27
enter the value of denominator: [2 9 27]
den2 =
2 9 27
num12 =
0 9 27 0
den12 =
18 115 396 459

num/den =
9 s^2 + 27 s

18 s^3 + 115 s^2 + 396 s + 459


Aim: using conv function reduce the series block in block diagram.

Relevant CO-CO1- Understand the fundamental of feedback control system.

Input:
num1 = [1 0]
den1 = [9 17]
num2 = 9*[1 3]
den2 = [2 9 27]
num12 =conv (num1, num2)
den12 = conv (den1, den2)
printsys (num12, den12)

Output
num1 =
1 0
den1 =
9 17
num2 =
9 27
den2 =
2 9 27

num12 =
9 27 0
den12 =
18 115 396 459
num/den =
9 s^2 + 27 s

18 s^3 + 115 s^2 + 396 s + 459


Part B
Aim: - using parallel function reduce given block diagram.

Input:
num1 = input ('enter the value of numerator:')
den1 = input ('enter the value of denominator:')
num2 = input ('enter the value of numerator:')
den2 = input ('enter the value of denominator:')
[num12, den12] = parallel (num1, den1, num2, den2)
printsys (num12, den12)

Output:
enter the value of numerator: [1 2]
num1 =
1 2
enter the value of denominator: [1 2 3]
den1 =
1 2 3
enter the value of numerator: [1 3]

num2 =
1 3
enter the value of denominator: [1 -4 1]
den2 =
1 -4 1
num12 =
0 2 3 2 11
den12 =
1 -2 -4 -10 3
num/den =
2 s^3 + 3 s^2 + 2 s + 11

s^4 - 2 s^3 - 4 s^2 - 10 s + 3


Part C
Aim: - Closed loop transfer function with unity feedback can be simplified using
cloop command.

Input:
num = 9;
den = [1 5]
[numcl, dencl] = cloop (num, den, -1);
Printsys (numcl, dencl)

Output:
num =
9
den =
1 5
num/den =
9

s + 14

Part D
Aim: - If the feedback is not unity then we can use feedback command to simplify
the canonical form.

Input:
num1 = input ('enter the value of numerator:')
den1 = input ('enter the value of denominator:')
num2 = input ('enter the value of numerator:')
den2 = input ('enter the value of denominator:')
[numcl, dencl] = feedback (num1, den1, num2, den2, -1)
Printsys (numcl, dencl)

Output:
enter the value of numerator:[1]
num1 =
1
enter the value of denominator: [1 1]
den1 =
1 1
enter the value of numerator: [2]
num2 =
2
enter the value of denominator: [1 0]
den2 =
1 0
numcl =
0 1 0
dencl =
1 1 2
num/den =
s

s^2 + s + 2

Date Sign Grade/Mark


EXPERIMENT: - 6
Aim: - Reduce the block diagram using MATLAB function.

Relevant CO-CO1- Understand the fundamental of feedback control system.

Question. 1

1
s2

1
s

Input
numk = 10;

denk = 1;

num1 = 1;

den1 = [1 1];

numf1 = 1;

denf1 = [1 2];

numf2 = 1;

denf2 = [1 0];

sys1 = tf (num1, den1)

[num12, den12] = series (num1, den1, numk, denk);

sys2 = tf (num12, den12)

[numf12, denf12] = feedback (num12, den12, numf1, denf1);

sys3 = tf (numf12, denf12)


[numf21, denf22] = feedback (numf12, denf12, numf2, denf2);

sys = tf (numf21, denf22)

output
sys1 =

s+1

Continuous-time transfer function.

sys2 =

10

s+1

Continuous-time transfer function.

sys3 =

10 s + 20

s^2 + 3 s + 12

Continuous-time transfer function.

sys =

10 s^2 + 20 s

s^3 + 3 s^2 + 22 s + 20

Continuous-time transfer function.


Question. 2

Input
numk = -10;

denk = 1;

num1 = [7 7];

den1 = [1 3 0];

num2 = 1;

den2 = [1 2 1];

sys1 = tf (num1, den1)

[numk1, denk1] = series (num1, den1, numk, denk);

sysk1 = tf (numk1, denk1)

[num12, den12] = parallel (numk1, denk1, num2, den2);

sys12 = tf (num12, den12)

[numf, denf] = feedback (num12, den12, num2, den2, -1);

sysf = tf (numf, denf)

[num, den] = cloop (numf, denf, -1);


sys = tf (num, den)

output
sys1 =

7s+7

s^2 + 3 s

Continuous-time transfer function.

sysk1 =

-70 s - 70

s^2 + 3 s

Continuous-time transfer function.

sys12 =

-70 s^3 - 209 s^2 - 207 s - 70

s^4 + 5 s^3 + 7 s^2 + 3 s

Continuous-time transfer function.

sysf =

-70 s^5 - 349 s^4 - 695 s^3 - 693 s^2 - 347 s - 70

s^6 + 7 s^5 + 18 s^4 - 48 s^3 - 196 s^2 - 204 s - 70


Continuous-time transfer function.
sys =

-70 s^5 - 349 s^4 - 695 s^3 - 693 s^2 - 347 s - 70

s^6 - 63 s^5 - 331 s^4 - 743 s^3 - 889 s^2 - 551 s - 140

Continuous-time transfer function.

Question. 3

Input
num1 = 1

den1 = [1 3]

num2 = 2

den2 = [1 1]

num3 = 1

den3 = [1 0]

numf1 = 0.3
denf1 = 1

numf2 = 0.4

denf2 = 1

numk = 10

denk = 1

[numk1, denk1] = series (num1, den1, numk, denk);

sys1 = tf (numk1, denk1)

[num11, den11] = feedback (numk1, denk1, numf1, denf1);sys2 = tf

(num11, den11)

[num12, den12] = series (num11, den11, num2, den2);

sys3 = tf (num12, den12)

[num13, den13] = feedback (num12, den12, numf2, denf2);

sys4 = tf (num13, den13)

[num, den] = series (num13, den13, num3, den3);

sys = tf(num,den)

Output
sys1 =

10

s+3

Continuous-time transfer function.


sys2 =

10

s+6

Continuous-time transfer function.

sys3 =

20

s^2 + 7 s + 6

Continuous-time transfer function.

sys4 =

20

s^2 + 7 s + 14

Continuous-time transfer function.

sys =

20

s^3 + 7 s^2 + 14 s

Continuous-time transfer function.

Date Sign Grade/Mark


EXPERIMENT: -7
Aim: - Using Simulink check Step function and impulse function and verify with
MATLAB code. Also verify the waveform for response of control system using CRO.
Relevant CO-CO3- Determine the time and frequency-domain responses of first and second-order
systems to step and other standard inputs.
1. Step Function

Simulink Diagram

Output
2. Impulse Function

Simulink Diagram

Output
MATLAB Code
num = input ('Enter the value of Numerator:')

den = input ('Enter the value of Denominator: ')

t = tf (num, den)

subplot (2,1,1)
stepplot(t)

subplot (2,1,2)

impulseplot(t)

Output
Enter the value of Numerator:[1]
num =

Enter the value of Denominator: [4 2 5]


den =

4 2 5

t=

4 s^2 + 2 s + 5

Continuous-time transfer function.


Also verify the waveform for response of control system using CRO.

(Attach/ Write conclusion for the waveforms obtained on CRO for Input and Controlled response.)

Date Sign Grade/Mark


EXPERIMENT: - 8
Aim: - To plot Root Locus of different system using MATLAB.
Relevant CO-CO2- Understand time response specifications and determine the
(absolute)stability of a closed-loop control system.

MATLAB Functions: -
rlocus(sys): - rlocus(sys) computes and plots the root locus of the single-input,
single-output LTI model SYS. The root locus plot is used to analyze the negative
feedback loop. and shows the trajectories of the closed-loop poles when the feedback
gain K varies from 0 to Inf. rlocus automatically generates a set of positive gain values
that produce a smooth plot.

rlocus (sys, k): - rlocus (SYS, K) uses a user-specified vector K of gain values.
rlocus (sys1, sys2, …): - rlocus (SYS1, SYS2, …) draws the root loci of several
models SYS1, SYS2, ... on a single plot. You can specify a color, line style, and marker
for each model,
for example: rlocus (sys1,'r’, sys2,'y:’, sys3, 'b')

[r, k] = rlocus(sys): - [r, k] = rlocus(sys) or r = rlocus (sys, k) returns the matrix R of


complex root locations for the gains K. R has LENGTH(K) columns and its j-the column lists
the closed-loop roots for the gain K(j).

Part A
MATLAB Code
num = input ('Enter the value of numerator:')

den = input ('Enter the value of denominator:')

s = tf (num, den)

rlocus(s)

Output
Enter the value of numerator: [ 1 3 10]

num =

1 3 10

Enter the value of denominator: [1 4 105 202]

den =

1 4 105 202

s=
s^2 + 3 s + 10

s^3 + 4 s^2 + 105 s + 202

Continuous-time transfer function.

Part B
MATLAB Code

num = input ('Enter the value of numerator:')


den = input ('Enter the value of denominator:')
k = input ('Enter the value of gain')
s = tf (num, den)
r = rlocus (s, k)
rlocus (s, k)
Output
Enter the value of numerator: [ 1 2]

num =

1 2

Enter the value of denominator: [ 1 5 8 0 0]

den =
1 5 8 0 0
Enter the value of gain [10]

k=

10
s=

s+2

s^4 + 5 s^3 + 8 s^2

Continuous-time transfer function.

r=

-2.7286 + 0.7401i

-2.7286 - 0.7401i
0.2286 + 1.5652i

0.2286 - 1.5652i
Part C
MATLAB Code
num = input ('Enter the value of numerator:')

den = input ('Enter the value of denominator:')

s = tf (num, den)

[r, k] = rlocus(s)

rlocus (s, k)

Output
Enter the value of numerator: [ 1 2]

num =
1 2

Enter the value of denominator: [ 1 5 8 0 0]

den =

1 5 8 0 0

s=

s+2

s^4 + 5 s^3 + 8 s^2

Continuous-time transfer function.


r=

1.0e+02 *

Columns 1 through 6

0.0000 + 0.0000i 0.0000 + 0.0001i 0.0000 + 0.0001i 0.0000 + 0.0001i 0.0000 +


0.0002i 0.0000 + 0.0002i

0.0000 + 0.0000i 0.0000 - 0.0001i 0.0000 - 0.0001i 0.0000 - 0.0001i 0.0000 - 0.0002i
0.0000 - 0.0002i

-0.0250 + 0.0132i -0.0250 + 0.0132i -0.0250 + 0.0132i -0.0250 + 0.0132i -0.0250 +


0.0132i -0.0250 + 0.0132i

-0.0250 - 0.0132i -0.0250 - 0.0132i -0.0250 - 0.0132i -0.0250 - 0.0132i -0.0250 - 0.0132i
-0.0250 - 0.0132i
Columns 7 through 12

0.0000 + 0.0002i 0.0000 + 0.0002i 0.0000 + 0.0003i 0.0000 + 0.0003i 0.0000 +


0.0004i 0.0000 + 0.0004i

0.0000 - 0.0002i 0.0000 - 0.0002i 0.0000 - 0.0003i 0.0000 - 0.0003i 0.0000 - 0.0004i
0.0000 - 0.0004i

-0.0250 + 0.0132i -0.0250 + 0.0132i -0.0250 + 0.0132i -0.0250 + 0.0132i -0.0250 +


0.0132i -0.0250 + 0.0132i

-0.0250 - 0.0132i -0.0250 - 0.0132i -0.0250 - 0.0132i -0.0250 - 0.0132i -0.0250 - 0.0132i
-0.0250 - 0.0132i

Columns 13 through 18

0.0000 + 0.0005i 0.0000 + 0.0006i 0.0000 + 0.0007i 0.0000 + 0.0008i 0.0000 +


0.0009i 0.0000 + 0.0010i

0.0000 - 0.0005i 0.0000 - 0.0006i 0.0000 - 0.0007i 0.0000 - 0.0008i 0.0000 - 0.0009i
0.0000 - 0.0010i

-0.0250 + 0.0132i -0.0250 + 0.0132i -0.0250 + 0.0132i -0.0250 + 0.0132i -0.0250 +


0.0132i -0.0250 + 0.0132i

-0.0250 - 0.0132i -0.0250 - 0.0132i -0.0250 - 0.0132i -0.0250 - 0.0132i -0.0250 - 0.0132i
-0.0250 - 0.0132i

Columns 19 through 24
0.0000 + 0.0012i 0.0000 + 0.0014i 0.0000 + 0.0016i 0.0000 + 0.0018i 0.0000 +
0.0021i 0.0000 + 0.0024i

0.0000 - 0.0012i 0.0000 - 0.0014i 0.0000 - 0.0016i 0.0000 - 0.0018i 0.0000 - 0.0021i
0.0000 - 0.0024i

-0.0250 + 0.0132i -0.0250 + 0.0132i -0.0250 + 0.0132i -0.0250 + 0.0131i -0.0250 +


0.0131i -0.0250 + 0.0131i

-0.0250 - 0.0132i -0.0250 - 0.0132i -0.0250 - 0.0132i -0.0250 - 0.0131i -0.0250 - 0.0131i
-0.0250 - 0.0131i

Columns 25 through 30
0.0001 + 0.0028i 0.0001 + 0.0033i 0.0001 + 0.0038i 0.0001 + 0.0044i 0.0002 +
0.0051i 0.0002 + 0.0059i

0.0001 - 0.0028i 0.0001 - 0.0033i 0.0001 - 0.0038i 0.0001 - 0.0044i 0.0002 - 0.0051i
0.0002 - 0.0059i

-0.0251 + 0.0130i -0.0251 + 0.0130i -0.0251 + 0.0129i -0.0251 + 0.0127i -0.0252 +


0.0126i -0.0252 + 0.0124i

-0.0251 - 0.0130i -0.0251 - 0.0130i -0.0251 - 0.0129i -0.0251 - 0.0127i -0.0252 - 0.0126i
-0.0252 - 0.0124i

Columns 31 through 36

0.0003 + 0.0068i 0.0005 + 0.0079i 0.0006 + 0.0091i 0.0009 + 0.0105i 0.0013 +


0.0121i 0.0018 + 0.0140i

0.0003 - 0.0068i 0.0005 - 0.0079i 0.0006 - 0.0091i 0.0009 - 0.0105i 0.0013 - 0.0121i
0.0018 - 0.0140i
-0.0253 + 0.0121i -0.0255 + 0.0117i -0.0256 + 0.0112i -0.0259 + 0.0105i -0.0263 +
0.0097i -0.0268 + 0.0086i

-0.0253 - 0.0121i -0.0255 - 0.0117i -0.0256 - 0.0112i -0.0259 - 0.0105i -0.0263 - 0.0097i
-0.0268 - 0.0086i

Columns 37 through 42

0.0024 + 0.0160i 0.0032 + 0.0182i 0.0036 + 0.0192i 0.0040 + 0.0202i 0.0040 +


0.0202i 0.0040 + 0.0202i

0.0024 - 0.0160i 0.0032 - 0.0182i 0.0036 - 0.0192i 0.0040 - 0.0202i 0.0040 - 0.0202i
0.0040 - 0.0202i

-0.0274 + 0.0071i -0.0282 + 0.0050i -0.0286 + 0.0035i -0.0290 + 0.0003i -0.0290 +


0.0000i -0.0287 + 0.0000i

-0.0274 - 0.0071i -0.0282 - 0.0050i -0.0286 - 0.0035i -0.0290 - 0.0003i -0.0290 + 0.0000i
-0.0293 + 0.0000i

Columns 43 through 48
0.0042 + 0.0206i 0.0053 + 0.0232i 0.0067 + 0.0260i 0.0082 + 0.0291i 0.0099 +
0.0324i 0.0119 + 0.0361i
0.0042 - 0.0206i 0.0053 - 0.0232i 0.0067 - 0.0260i 0.0082 - 0.0291i 0.0099 - 0.0324i
0.0119 - 0.0361i

-0.0269 + 0.0000i -0.0241 + 0.0000i -0.0228 + 0.0000i -0.0220 + 0.0000i -0.0214 +


0.0000i -0.0211 + 0.0000i
-0.0314 + 0.0000i -0.0366 + 0.0000i -0.0406 + 0.0000i -0.0444 + 0.0000i -0.0484 +
0.0000i -0.0527 + 0.0000i

Columns 49 through 54
0.0140 + 0.0400i 0.0164 + 0.0443i 0.0190 + 0.0490i 0.0219 + 0.0542i 0.0251 +
0.0599i 0.0287 + 0.0661i

0.0140 - 0.0400i 0.0164 - 0.0443i 0.0190 - 0.0490i 0.0219 - 0.0542i 0.0251 - 0.0599i
0.0287 - 0.0661i

-0.0208 + 0.0000i -0.0206 + 0.0000i -0.0204 + 0.0000i -0.0203 + 0.0000i -0.0202 +


0.0000i -0.0202 + 0.0000i

-0.0572 + 0.0000i -0.0622 + 0.0000i -0.0676 + 0.0000i -0.0735 + 0.0000i -0.0800 +


0.0000i -0.0872 + 0.0000i

Columns 55 through 57

0.0326 + 0.0730i 0.9401 + 1.6456i Inf + 0.0000i

0.0326 - 0.0730i 0.9401 - 1.6456i Inf + 0.0000i

-0.0201 + 0.0000i -0.0200 + 0.0000i -0.0200 + 0.0000i

-0.0950 + 0.0000i -1.9102 + 0.0000i Inf + 0.0000i

k=

1.0e+06 *

Columns 1 through 11

0 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000


0.0000

Columns 12 through 22

0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
0.0000

Columns 23 through 33

0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
0.0000

Columns 34 through 44

0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
0.0000

Columns 45 through 55
0.0000 0.0000 0.0001 0.0001 0.0001 0.0001 0.0002 0.0003 0.0003 0.0005
0.0006

Columns 56 through 57

6.8615 Inf

Part D
MATLAB Code
num1 = input ('Enter the value of numerator1:')
den1 = input ('Enter the value of denominator1:')

s1 = tf (num1, den1)

num2 = input ('Enter the value of numerator2:')

den2 = input ('Enter the value of denominator2:')

s2 = tf (num2, den2)

rlocus (s1,'r’, s2,'b')

Output
Enter the value of numerator1: [ 1 2]

num1 =
1 2

Enter the value of denominator1: [1 5 8 0 0]


den1 =

1 5 8 0 0

s1 =

s+2

s^4 + 5 s^3 + 8 s^2

Continuous-time transfer function.

Enter the value of numerator2: [1 3 10]

num2 =

1 3 10

Enter the value of denominator2: [ 1 4 105 202]

den2 =
1 4 105 202

s2 =

s^2 + 3 s + 10

s^3 + 4 s^2 + 105 s + 202

Continuous-time transfer function.

Date Sign Grade/Mark


EXPERIMENT: - 9
Aim: - To plot bode plot using MATLAB functions. Also verify the response for
Compensators using CRO.
Relevant CO- CO3 :- Determine the time and frequency-domain responses of first and second-
order systems to step and other standard inputs.

MATLAB commands: -
bode (SYS): - bode (SYS) draws the Bode plot of the dynamic system SYS. The
frequency range and number of points are chosen automatically.

bode (SYS, {WMIN, WMAX}): - bode (SYS, {WMIN, WMAX}) draws the Bode
plot for frequencies between WMIN and WMAX in radians/Time Unit (relative to
the time units specified in SYS. Time Unit, the default being seconds).\

bode (SYS, W): - bode (SYS, W) uses the vector W of frequencies (in
radians/Time Unit) to evaluate the frequency response. See LOGSPACE to generate
logarithmically spaced frequency vectors.

bode (SYS1, SYS2, ….., W): - bode(SYS1,SYS2,...,W) graphs the Bode response
of several systems SYS1,SYS2,... on a single plot. The frequency vector W is optional.
You can specify a color, line style, and marker for each model, for
example: bode (sys1, 'r', sys2, 'y--', sys3, 'gx').

[MAG, PHASE]: - [MAG, PHASE] = bode (SYS, W) and [MAG, PHASE, W] =


bode (SYS) return the response magnitudes and phases in degrees (along with the
frequency vector W if unspecified). No plot is drawn on the screen.

Part A

Input
num=input (‘Enter the numerator:’)

den=input (‘Enter the denotator:’)

sys=tf (num, den)

bode (sys)

grid on
Output
Enter the numerator:

[20]

num =

20

Enter the denotator:

[ 0.1 1.0 0]

den =

0.1000 1.0000 0

sys =

20

0.1 s^2 + s

Continuous-time transfer function.


Part B
Input
num1=input ('Enter the numerator1:')

den1=input ('Enter the denominator1:’)

num2=input ('Enter the numerator 2:')

den2=input ('Enter the denominator2: ')

sys1=tf (num1, den1)

sys2=tf (num2, den2)

bode (sys1, sys2)

grid on
Output

Enter the numerator1: [20]

num1 =

20

Enter the denominator1: [0.1 1 0]

den1 =

0.1000 1.0000 0

Enter the numerator 2: [80]

num2 =

80
Enter the denominator2: [1 22 40 0]

den2 =

1 22 40 0

sys1 =

20
0.1 s^2 + s

Continuous-time transfer function.

sys2 =

80

s^3 + 22 s^2 + 40 s

Continuous-time transfer function.

Part C
Input
num1=input ('Enter the numerator1:')

den1=input ('Enter the denominator1:')


num2=input ('Enter the numerator 2:')
den2=input ('Enter the denominator2: ')

sys1=tf (num1, den1)

sys2=tf (num2, den2)

bode (sys1,'r’, sys2,'b--')

grid on
Output

Enter the numerator1: [20]

num1 =

20

Enter the denominator1: [0.1 1 0]

den1 =

0.1000 1.0000 0

Enter the numerator 2: [80]

num2 =

80

Enter the denominator2: [1 22 40 0]

den2 =

1 22 40 0

sys1 =

20

0.1 s^2 + s

Continuous-time transfer function.

sys2 =
80

s^3 + 22 s^2 + 40 s

Continuous-time transfer function.

Part D
Input
num=input (‘Enter the numerator:’)

den=input (‘Enter the denotator:’)

sys=tf (num, den)

bode (sys, {0.1 1000})

grid on
Output
Enter the numerator: [20]
num =

20

Enter the denotator: [0.1 1 0]

den =

0.1000 1.0000 0

sys =

20

0.1 s^2 + s

Continuous-time transfer function.


Part E
Input
num=input (‘Enter the numerator:’)

den=input (‘Enter the denotator:’)

sys=tf (num, den)

bode(sys)

[mag, phase, wout] = bode (sys, {0.1 1000})

grid on
Output

Enter the numerator: [20]

num = 20

Enter the denotator: [0.1 1 0]

den =

0.1000 1.0000 0

sys =

20

0.1 s^2 + s

Continuous-time transfer function.


mag(:,:,1) = 16.3343
57.3315
199.9900
mag(:,:,18) =
mag(:,:,10) =
mag(:,:,2) = 13.9363
49.0343
171.0818
mag(:,:,19) =
mag(:,:,11) =
mag(:,:,3) = 11.8791
41.9345
146.3512
mag(:,:,20) =
mag(:,:,12) =
mag(:,:,4) = 10.1125
35.8587
125.1944
mag(:,:,21) =
mag(:,:,13) =
mag(:,:,5) = 8.5939
30.6586
107.0947
mag(:,:,22) =
mag(:,:,14) =
mag(:,:,6) = 7.2867
26.2072
91.6101
mag(:,:,23) =
mag(:,:,15) =
mag(:,:,7) = 6.1598
22.3958
78.3626
mag(:,:,24) =
mag(:,:,16) =
mag(:,:,8) = 5.1868
19.1314
67.0287
mag(:,:,25) =
mag(:,:,17) =
mag(:,:,9) = 4.3456

Page | 61
mag(:,:,34) = 0.0544
mag(:,:,26) =
0.5803
3.6180 mag(:,:,43) =

mag(:,:,35) = 0.0400
mag(:,:,27) =
0.4398
2.9890 mag(:,:,44) =

mag(:,:,36) = 0.0293
mag(:,:,28) =
0.3307
2.4469 mag(:,:,45) =

mag(:,:,37) = 0.0215
mag(:,:,29) =
0.2471
1.9822 mag(:,:,46) =

mag(:,:,38) = 0.0158
mag(:,:,30) =
0.1837
1.5875 mag(:,:,47) =

mag(:,:,39) = 0.0115
mag(:,:,31) =
0.1361
1.2560 mag(:,:,48) =

mag(:,:,40) = 0.0085
mag(:,:,32) =
0.1005
0.9819 mag(:,:,49) =
mag(:,:,41) =
0.0062
mag(:,:,33) = 0.0740

0.7588 mag(:,:,50) =
mag(:,:,42) =

Page | 62
0.0045
phase(:,:,7) =
mag(:,:,59) =
mag(:,:,51) = -91.4615
2.7327e-04
0.0033
phase(:,:,8) =
mag(:,:,60) =
mag(:,:,52) = -91.7083
1.9999e-04
0.0024
phase(:,:,9) =
phase(:,:,1) =
mag(:,:,53) = -91.9967
-90.5729
0.0018
phase(:,:,10) =
phase(:,:,2) =
mag(:,:,54) = -92.3337
-90.6697
0.0013
phase(:,:,11) =
phase(:,:,3) =
mag(:,:,55) = -92.7275
-90.7829
9.5256e-04
phase(:,:,12) =
phase(:,:,4) =
mag(:,:,56) = -93.1874
-90.9151
6.9715e-04
phase(:,:,13) =
phase(:,:,5) =
mag(:,:,57) = -93.7245
-91.0697
5.1022e-04
phase(:,:,14) =
phase(:,:,6) =
mag(:,:,58) = -94.3515
-91.2504
3.7340e-04

Page | 63
phase(:,:,15) = -107.2295

-95.0832 phase(:,:,32) =
phase(:,:,24) =
-141.6477
phase(:,:,16) = -109.9262

-95.9363 phase(:,:,33) =
phase(:,:,25) =
-145.9069
phase(:,:,17) = -112.9652

-96.9302 phase(:,:,34) =
phase(:,:,26) =
-149.9273
phase(:,:,18) = -116.3517

-98.0866 phase(:,:,35) =
phase(:,:,27) =
-153.6483
phase(:,:,19) = -120.0727

-99.4301 phase(:,:,36) =
phase(:,:,28) =
-157.0348
phase(:,:,20) = -124.0931

-100.9872 phase(:,:,37) =
phase(:,:,29) =
phase(:,:,21) = -160.0738
-128.3523
-102.7867
phase(:,:,38) =
phase(:,:,30) =
phase(:,:,22) = -162.7705
-132.7662
-104.8580
phase(:,:,39) =
phase(:,:,31) =
phase(:,:,23) = -165.1420
-137.2338

Page | 64
phase(:,:,48) =
phase(:,:,40) = -178.9303
-176.2755
-167.2133
phase(:,:,57) =
phase(:,:,49) =
phase(:,:,41) = -179.0849
-176.8126
-169.0128
phase(:,:,58) =
phase(:,:,50) =
phase(:,:,42) = -179.2171
-177.2725
-170.5699
phase(:,:,59) =
phase(:,:,51) =
phase(:,:,43) = -179.3303
-177.6663
-171.9134
phase(:,:,60) =
phase(:,:,52) =
phase(:,:,44) = -179.4271
-178.0033
-173.0698 wout =

phase(:,:,53) = 1.0e+03 *
phase(:,:,45) =
-178.2917 0.0001
-174.0637 0.0001
0.0001
phase(:,:,54) = 0.0002
phase(:,:,46) = 0.0002
-178.5385 0.0002
-174.9168 0.0003
0.0003
phase(:,:,55) = 0.0003
phase(:,:,47) = 0.0004
-178.7496 0.0005
-175.6485 0.0006
0.0007
phase(:,:,56) = 0.0008

Page | 65
0.0009 0.0126 0.1796
0.0010 0.0148 0.2099
0.0012 0.0173 0.2454
0.0014 0.0202 0.2868
0.0017 0.0236 0.3353
0.0019 0.0276 0.3919
0.0023 0.0322 0.4582
0.0027 0.0377 0.5356
0.0031 0.0441 0.6261
0.0036 0.0515 0.7318
0.0042 0.0602 0.8555
0.0050 0.0704 1.0000
0.0058 0.0823
0.0068 0.0962
0.0079 0.1124
0.0092 0.1314
0.0108 0.1536

Page | 66
Part F
Input
num=input (‘Enter the numerator:’)
den=input (‘Enter the denotator:’)

sys = tf (num, den)

bode (sys)

[mag, phase, wout] = bode (sys)

grid on

Output
Enter the numerator:

[20]

num =

20

Enter the denotator:

[0.1 1 0]

den =

0.1000 1.0000 0

sys =

Page | 67
20

0.1 s^2 + s

Continuous-time transfer function.

mag(:,:,1) = mag(:,:,5) = mag(:,:,9) =

199.9900 62.5031 33.3821

mag(:,:,2) = mag(:,:,6) = mag(:,:,10) =

99.9800 53.4394 28.5279

mag(:,:,3) = mag(:,:,7) = mag(:,:,11) =

85.4914 45.6868 24.3738

mag(:,:,4) = mag(:,:,8) = mag(:,:,12) =

73.1004 39.0553 20.8178

Page | 68
mag(:,:,13) = 9.3610

mag(:,:,24) =

19.9007

mag(:,:,19) = 3.2980

mag(:,:,14) = 7.9441

mag(:,:,25) =

17.7727

mag(:,:,20) = 2.7116

mag(:,:,15) = 6.7240

mag(:,:,26) =

15.1639

mag(:,:,21) = 2.2076

mag(:,:,16) = 5.6718

mag(:,:,27) =

12.9275

mag(:,:,22) = 1.7775

mag(:,:,17) = 4.7630

mag(:,:,28) =

11.0088

mag(:,:,23) = 1.4142

mag(:,:,18) = 3.9773
mag(:,:,29) =

Page | 69
mag(:,:,40) =

1.1116

mag(:,:,35) = 0.0462

mag(:,:,30) = 0.2121 mag(:,:,41) =

0.8633 0.0339

mag(:,:,36) =

mag(:,:,31) = 0.1573 mag(:,:,42) =

0.6631 0.0249

mag(:,:,37) =

mag(:,:,32) = 0.1162 mag(:,:,43) =

0.5044 0.0199

mag(:,:,38) =

mag(:,:,33) = 0.0856 mag(:,:,44) =

0.3804 0.0182

mag(:,:,39) =

mag(:,:,34) = 0.0630 mag(:,:,45) =

0.2849 0.0133

Page | 70
mag(:,:,51) = -90.5729

mag(:,:,46) = 0.0020

phase(:,:,2) =

0.0098

mag(:,:,52) = -91.1458

mag(:,:,47) = 0.0015

phase(:,:,3) =

0.0071

mag(:,:,53) = -91.3398

mag(:,:,48) = 0.0011

phase(:,:,4) =

0.0052

mag(:,:,54) = -91.5666

mag(:,:,49) = 7.9984e-04

phase(:,:,5) =
0.0038

mag(:,:,55) = -91.8318

mag(:,:,50) = 1.9999e-04

phase(:,:,6) =

0.0028
phase(:,:,1) = -92.1418

Page | 71
phase(:,:,7) = -95.4629

phase(:,:,18) =

-92.5042

phase(:,:,13) = -101.8119

phase(:,:,8) = -95.7106

phase(:,:,19) =

-92.9277

phase(:,:,14) = -103.7421

phase(:,:,9) = -96.3811

phase(:,:,20) =

-93.4225

phase(:,:,15) = -105.9593

phase(:,:,10) = -97.4508

phase(:,:,21) =
-94.0005

phase(:,:,16) = -108.4908

phase(:,:,11) = -98.6949

phase(:,:,22) =

-94.6754

phase(:,:,17) = -111.3587

phase(:,:,12) = -100.1393

Page | 72
phase(:,:,23) = phase(:,:,34) =

-114.5749 phase(:,:,29) = -158.6413

-139.4647

phase(:,:,24) = phase(:,:,35) =

-118.1364 phase(:,:,30) = -161.5092

-143.8228
phase(:,:,25) = phase(:,:,36) =

-122.0198 phase(:,:,31) = -164.0407

phase(:,:,26) = -147.9802

phase(:,:,37) =

-126.1772

phase(:,:,32) = -166.2579

phase(:,:,27) = -151.8636

phase(:,:,38) =

-130.5353

phase(:,:,33) = -168.1881

phase(:,:,28) = -155.4251

phase(:,:,39) =
-135

Page | 73
-169.8607

phase(:,:,45) = -177.8582

phase(:,:,40) = -175.3246

phase(:,:,51) =

-171.3051

phase(:,:,46) = -178.1682

phase(:,:,41) = -175.9995

phase(:,:,52) =
-172.5492

phase(:,:,47) = -178.4334

phase(:,:,42) = -176.5775

phase(:,:,53) =

-173.6189

phase(:,:,48) = -178.6602

phase(:,:,43) = -177.0723
phase(:,:,54) =

-174.2894

phase(:,:,49) = -178.8542

phase(:,:,44) = -177.4958

phase(:,:,55) =

-174.5371
phase(:,:,50) = -179.4271

Page | 74
0.0039 0.2287

0.0046 0.2674

wout = 0.0053 0.3127

0.0063 0.3656

1.0e+03 * 0.0073 0.4276

0.0086 0.5000

0.0001 0.0100 1.00

0.0002 0.0117
0.0002 0.0137

0.0003 0.0160
0.0003 0.0187

0.0004 0.0219

0.0004 0.0256

0.0005 0.0299

0.0006 0.0350

0.0007 0.0409

0.0008 0.0478

0.0010 0.0559

0.0010 0.0654

0.0011 0.0765

0.0013 0.0894
0.0015 0.1000

0.0018 0.1046

0.0021 0.1223

0.0024 0.1430

0.0029 0.1672
0.0033 0.1955

Page | 75
Page | 76
Also verify the response for Compensators using CRO.

(Attach /Explain the waveforms for response for various compensators using CRO.)

Date Sign Grade/Mark

Page | 77
EXPERIMENT 10
Aim: To perform PID controller using MATLAB Simulink and verify its response.

Relevant CO- CO4 - Design controller as per given specificationsusing different


techniques.

MATLAB Description: PID Create a pid controller in parallel form. Construction:


SYS = pid (Kp, Ki, Kd, Tf) creates a continuous-time pid controller

in parallel form with a first-order derivative filter:

Ki Kd*s

Kp + +

s Tf*s+1

The scalars Kp, Ki, Kd, and Tf specify the proportional gain, integral gain, derivative

gain, and filter time constant. The Tf value must be nonnegative for stability. The

default values are Kp=1, Ki=0, Kd=0, and Tf=0. If a parameter is omitted, its default

value is used. For example, pid(Kp,Ki,Kd) creates a pid controller with pure derivative

term. The resulting SYS is of type pid if Kp,Ki,Kd,Tf are all real, and of type GENSS if

one of the gains is tunable (see REALP and GENMAT).

SYS = pid (Kp,Ki,Kd,Tf,Ts) creates a discrete-time pid controllerwith sample time Ts>0.
The discrete-time pid formula is

Kd

Kp + Ki * IF(z) + --------------

Tf + DF(z)

where IF(z) and DF(z) are the discrete integrator formulas for theintegral and

derivative terms. Use the "IFormula" and "DFormula"

Page | 78
properties to specify these formulas. Available formulas include:

'Forward Euler' Ts/(z-1)

'Backward Euler' Ts*z/(z-1)

'Trapezoidal' (Ts/2)*(z+1)/(z-1)

The default formula is Forward Euler. The 'I Formula' and 'D Formula'settings are

ignored for continuous-time PIDs. The following settings are disallowed because

they generate unstable PIDs:


(1) (Kd > 0, Tf = 0) and DFormula='Trapezoidal'

(2) (Kd > 0, Tf > 0) and DFormula='ForwardEuler' and Ts>=2*Tf

You can set additional properties by using name/value pairs.

Simulink Diagram:

Page | 79
Output:

Date Sign Grade/Mark

Page | 80
EXPERIMENT: - 11

TO OBTAIN TIME RESPONSE SPECIFICATIONS AND TIME RESPENCE OF


SECOND ORDER SYSTEM.

AIM: To obtain the time response of second order system.

APPARATUS: Software-MATLAB
Computer.
THEORY:

The time response has utmost importance for the design and analysis of control systems
because these are inherently time domain systems where time is independent variable.
During the analysis of response, the variation of output with respect to time can be studied
and it is known as time response. To obtain satisfactory performance of the system with
respect to time must be within the specified limits. From time response analysis and
corresponding results, the stability of system, accuracy of system and complete evaluation
can be studied easily.

Due to the application of an excitation to a system, the response of the system is known as
timeresponse and it is a function of time. The two parts of response of any system:

(i) Transient response


(ii) Steady-state response.

Transient response: The part of the time response which goes to zero after large
interval oftime is known as transient response.
Steady state response: The part of response that means even after the transients have
died outis said to be steady state response.
The total response of a system is sum of transient response and steady state response:

A second order control system is one wherein the highest power of ‘s’ in the
denominator ofits transfer function equals 2. Transfer function is given by:

ωn—is called natural frequency of


oscillations.ς = is called damping factor .

Page | 81
MATLAB PROGRAM:

wn=input('enter value of undamped natural frequency')


z=input('enter value of damping ratio')
n=[wn*wn]
p=sqrt(1-z^2)
wd=wn*p
h=[p/z]
k=atan(h)
m=pi-k;
tr=[m/wd]
tp=[pi/wd]
q=z*wn
ts=[h/q]
r=z*pi
f=[r/p]
mp=exp(-f)
num=[0 0 n]
den=[1 2*z*wn n]
s=tf(num,den)
hold on
step(s)
impulse(s)
hold off

Example No 1

Undamped frequency wn=5 and Damping ratio z=0.6

>> wn=5

wn =

5
>> z=0.6

z=
0.600
0

>>

n=[wn*wn]

n=

25

Page | 82
>> p=sqrt(1-z^2)

p=

0.8000

>>

wd=wn*p

wd =

>>

h=[p/z]

h=

1.3333

>>

k=atan(h)

k=

0.9273

>> m=pi-k;
>>

tr=[m/wd]

tr =

0.5536

>>

tp=[pi/wd]

tp =

0.7854

Page | 83
>> q=z*wn
q=
3

>>

ts=[h/q]

ts =

0.4444

>> r=z*pi

r=

1.8850

>> f=[r/p]

f=

2.3562

>> mp=exp(-f)

mp =

0.0948

>> num=[0 0 n]

num =

0 0 25

>> den=[1 2*z*wn n]

den =

1 6 25

>>

Page | 84
s=tf(num,den)

Transfer

function:
25

s^2 + 6 s + 25
>> hold on
>> step(s)
>> impulse(s)
>> hold off

Page | 85
Example No 2

Undamped frequency wn= 4.899 and Damping ratio z= 0.5103

>> wn=4.899

wn =

4.8990

>> z=.5103

z = 0.5103

>>

n=[wn*wn]

n=

24.0002

>> p=sqrt(1-z^2)

p=

0.8600

>>

wd=wn*p

wd =

4.2131

>>

h=[p/z]

h=

1.6853

>>

k=atan(h)

Page | 86
k=

1.0353

>> m=pi-k;
>>

tr=[m/wd]

tr =

0.4999

>>

tp=[pi/wd]

tp =

0.7457

>> q=z*wn
q=

2.5000

>>

ts=[h/q]

ts =

0.6741

>> r=z*pi

r=

1.6032

>>

f=[r/p]

f=

1.8641

>> mp=exp(-f)

Page | 87
mp =

0.1550

>> num=[0 0 n]

num =

0 0 24.0002

>> den=[1 2*z*wn n]

den =

1.0000 4.9999 24.00

>>

s=tf(num,den)

Transfer

function:
24

s^2 + 5 s + 24

>> hold on
>> step(s)
>> impulse(s)
>> hold off

Page | 88
Date Sign Grade/Mark

Page | 89
EXPERIMENT: - 12

Part A:- TO OBTAIN TRANSFER FUNCTION FROM STATE MODEL

Part B : TO OBTAIN STATE MODEL FROM TRANSFER FUNCTION


AIM:- Part A:- To obtain transfer function from state model.

APPARATUS: Software-MATLAB
Computer.

THEORY:

The transfer function is defined as the ratio of Laplace transform of output to Laplace
transform ofinput. The transfer function of a given state model is given by:

A state space representation is a mathematical model of a physical system as a set of input,


output and state variables related by first-order differential equations. The state space
representation (also known as the "time-domain approach") provides a convenient and
compact way to model and analyze systems with multiple inputs and outputs. Unlike the
frequency domain approach, the use of the state space representation is not limited to systems
with linear components and zero initial conditions. "State space" refers to the space whose axes
are the state variables. The state of the system can be represented as a vector within that space.
The input state equation is given by,

The output equation is written as,

MATLAB PROGRAM:-

Case 1 :- Single Input and Single Output system (SISO)


n=input('enter the order of the system=')
m=input('enter the number of inputs=')
p=input('enter the number of outputs=')
A=rand(n,n)
B=rand(n,m)
C=rand(p,n)
D=rand(p,m)
[num,den]=ss2tf(A,B,C,D,1)

Page | 90
Case 2 :- Multiple Input and Multiple Output (MIMO)
%This program is formulated for double input double output
system.
n=input('enter the order of the system=')
m=input('enter the number of inputs=')
p=input('enter the number of outputs=')
A=rand(n,n)
B=rand(n,m)
C=rand(p,n)
D=rand(p,m)
[num,den]=ss2tf(A,B,C,D,1)
[num1,den1]=ss2tf(A,B,C,D,2)
a=tf(num(1,:),den)
b=tf(num(2,:),den)
c=tf(num1(1,:),den1)
d=tf(num1(2,:),den1)

Example :- 1
>> n=[3]
n=
3
>> m=[1]
m=
1
>> p=[1]
p=
1
>>
A=rand(n,n)
A=
0.4218 0.9595 0.8491
0.9157 0.6557 0.9340
0.7922 0.0357 0.6787
>>
B=rand(n,m)
B=
0.7577
0.7431
0.3922

Page | 91
>>
C=rand(p,n)

C=
0.6555 0.1712 0.7060

>>
D=rand(p,m)
D=
0.0318
>> [num,den]=ss2tf(A,B,C,D,1)
num =
0.0318 0.8449 0.1902 -0.0510
den =
1.0000 -1.7562 -0.5768 0.1261
>>
a=tf(num(1,:),den)
Transfer function:
0.03183 s^3 + 0.8449 s^2 + 0.1902 s - 0.05098

s^3 - 1.756 s^2 - 0.5768 s + 0.1261


>> c=tf(num1(1,:),den1)
Transfer function:
0.1419 s^3 + 1.436 s^2 - 1.399 s + 0.08242

s^3 - 2.405 s^2 + 0.9848 s + 0.2767

Page | 92
Case 2 :- Multiple Input and Multiple Output (MIMO)
>> n=[3]
n=
3
>> m=[2]
m=
2
>> p=[2]

p=
2
>>
A=rand(n,n)

A=
0.2769 0.8235 0.9502
0.0462 0.6948 0.0344
0.0971 0.3171 0.4387

>>
B=rand(n,m)

B=
0.3816 0.1869
0.7655 0.4898
0.7952 0.4456
>>
C=rand(p,n)

C=
0.6463 0.7547 0.6797
0.7094 0.2760 0.6551
>> D=rand(p,m)
D=
0.1626 0.4984
0.1190 0.9597

Page | 93
>> [num,den]=ss2tf(A,B,C,D,1)
num =
0.1626 1.1355 -0.0207 -0.1865

0.1190 0.8351 0.21 -0.2363

den =

1.0000 -1.4105 0.4775 -0.0173

>>
[num1,den1]=ss2tf(A,B,C,D,2)
num1 =
0.4984 0.0903 0.2125 -0.1167
0.9597 -0.7941 0.6343 -0.1548
den1 =
1.0000 -1.4105 0.4775 -0.0173

>>
a=tf(num(1,:),den)
Transfer function:
0.1626 s^3 + 1.135 s^2 - 0.02065 s - 0.1865

s^3 - 1.41 s^2 + 0.4775 s - 0.01725

>>
b=tf(num(2,:),den)
Transfer function:
0.119 s^3 + 0.8351 s^2 + 0.2715 s - 0.2363

s^3 - 1.41 s^2 + 0.4775 s - 0.01725

Page | 94
>> c=tf(num1(1,:),den1)
Transfer function:
0.4984 s^3 + 0.09032 s^2 + 0.2125 s - 0.1167

s^3 - 1.41 s^2 + 0.4775 s - 0.01725


>>
d=tf(num1(2,:),den1)
Transfer function:
0.9597 s^3 - 0.7941 s^2 + 0.6343 s - 0.1548

s^3 - 1.41 s^2 + 0.4775 s - 0.01725

AIM:_Part B :To obtain state model from transfer function


APPARATUS: Software-MATLAB
Computer.
THEORY:

There are three methods for obtaining state model from transfer function:
1. Phase variable method
2. Physical variable method
3. Canonical variable method

Out of three methods given above canonical form is probably the most straight forward
method for converting from the transfer function of a system to a state space model is to
generate a model in "controllable canonical form." This term comes from Control Theory
but its exact meaning is not important to us. To see how this method of generating a state
space model works, consider thethird order differential transfer function:

We start by multiplying by Z(s)/Z(s) and then solving for Y(s) and U(s) in terms of Z(s). We
alsoconvert back to a differential equation.

We can now choose z and its first two derivatives as our state variables

Page | 95
Now we just need to form the output

From these results we can easily form the state space model:

In this case, the order of the numerator of the transfer function was less than that of the
denominator.

MATLAB PROGRAM:-
num1=input('enter the numerator of the transfer function=')
den1=input('enter the denominator of the transfer function=')
[A,B,C,D]=tf2ss(num1,den1)

EXAMPLE:1
>> num=[0 0 1]
num =

0 0 1

>> den=[1 2 3]
den =

1 2 3

>>

s=tf(num,den)

Transfer

function:
1

s^2 + 2 s + 3

>> [A,B,C,D]=tf2ss(num,den)

A=

-2 -3
1 0

Page | 96
B=

1
0

C=

0 1

D=

EXAMPLE:2
>> num=[1 2 3]
num =

1 2 3

>> den=[1 2 5 6]
den =

1 2 5 6

>> s=tf(num,den)

Transfer
function:s^2 +
2s+3

s^3 + 2 s^2 + 5 s + 6

>> [A,B,C,D]=tf2ss(num,den)

A=
-2 -5 -6
1 0 0
0 1 0
B=
1
0
0

C=
1 2 3

D=
0

Page | 97
EXAMPLE:3

>> num=[ 1 3 5]
num =

1 3 5

>> den=[2 4 6 8]

den =

2 4 6 8

>> s=tf(num,den)

Transfer function:
s^2 + 3 s + 5

2 s^3 + 4 s^2 + 6 s + 8

>> [A,B,C,D]=tf2ss(num,den)

A=
-2 -3 -4
1 0 0
0 1 0

B=

1
0
0

C=

0.5000 1.5000 2.5000

D=

Date Sign Grade/Mark

Page | 98

You might also like