You are on page 1of 16

CONTROL ENGINEERING LAB

Term Project
(Academic activity assigned during June 12,2020 to July 15,202
the wake of COVID-19 pandemic)

(EED-327)

MATLAB codes and Results


Submitted by—Bhavesh Kanav Singh (17205)
CONTROL ENGG. LAB (EED 327)

Dr. Himesh Handa (Assistant Prof.)


“NATIONAL INSTITUTE OF TECHNOLOGY”

1|Page
NUMERICALS TO BE SOLVED USING
MATLAB

Theory: MATLAB is a high-performance language for technical computing. It


integrates computation, visualization, and programming in an easy-to-use
environment where problems and solutions are expressed in familiar mathematical
notation. Typical uses include:

 Math and computation


 Algorithm development
 Modeling, simulation, and prototyping
 Data analysis, exploration, and visualization
 Scientific and engineering graphics
 Application development, including Graphical User Interface building

Software used: MATLAB version R2016a

QUES 1. A unity feedback control system has the following forward path transfer
function
G(s)=210/s(s+2)(s2+12s+6)
Find the roots of the characteristic equation.
And the bode plot of the open loop transfer function.

MatLab Code:

clc
clear all

N = [210]; %numerator
D = [1 14 40 32 0 ]; %denomirator
z=[1 14 40 32 210]
sys=tf(N,D); %transfer function
roots_of_charachteristics_equation=roots(z);%to find roots
bode(sys);%bode plot
grid on;

2|Page
RESULT:

Command window showing roots of the characteristic equation

Bode plot for the open loop transfer function

Hence,we have successfully used the matlab simulation to find the the roots of the
characteristic equation and the bode plot of the open loop transfer function
G(s)=210/s(s+2)(s2+12s+6).

3|Page
QUES 2. Using MATLAB, sketch the bode plot for the transfer function
G(s)H(s)
2( s+0.25)
G( s) H (s)=
s ( s +1 ) (¿❑ s+0.5) ¿
2

From the Bode plot determine


(a) The phase crossover frequency
(b)The gain crossover frequency
(c)The gain margin
(d)The phase margin

MatLab code:
clc
clear all
N=[2 0.5];%numerator
D=[1 1.5 0.5 0 0];%denominator
sys=tf(N,D);%transfer function
% w=logspace(-1,2,100);%spacing
[Gm,Pm,Wcp,Wcg] = margin(sys)%Gm=gain margin;Pm=phase
margin;Wcp=phase crossover frequency;Wcg=gain crossover frequency
GmdB=20*log10(Gm)
bode(sys);%bode plot
grid on;

RESULT :

Command window showing output


4|Page
Bode plot of the transfer function

Hence,we have successfully used the matlab simulation sketch the bode plot for
the above given transfer function and find the out the gain margin, phase margin,
the gain crossover frequency, and phase crossover frequency.

QUESTION 3. Using MATLAB for the unity feedback system G(s)=10/(s2+2)


(s3+2*s2+2*s) determine the gain margin, phase margin, the gain crossover
frequency, and phase crossover frequency. Also draw the nyquists plot.

MatLab code:

clc;
clear all;
N=[10];%numerator
D=conv([1 0 2],[1 2 2 0]);%Denominator
sys=tf(N,D);%transfer function
nyquist(sys);%bode plot

5|Page
[Gm,Pm,Wcp,Wcg] = margin(sys) %gain margin, phase margin, gain crossover
frequency and phase crossover frequency
[GmdB]=20*log10(Gm);
grid on;

RESULT:

Command window showing results

Nyquist plot of the unity feed back system

6|Page
QUES 4. Using MATLAB sketch the root locus for the open loop transfer
function G(s)H(s)=k(s2 +4)/s(s+2)and calculate the value of gain (k) at
(1)Breakaway point= -0.5
(2)s=-0.69+j0.88

MatLab code:
%Root locus for a given transfer function
clc;
clear all;
N=[1 0 4];%nenomirator
D=conv([1 0],[1 2]);%denomirator
sys=tf(N,D);%transferfuntion
rlocus(sys);%rootlocus
grid on;

RESULT:

Root locus plot for open loop transfer function

7|Page
Gain at breakaway point= -0.5

Gain at s= -0.69+j0.88

8|Page
QUES 5. To study DC servomotor and to derive its transfer function. Taking
suitable values for the different parameters present in the transfer function
find out the unit step response of the DC servomotor.

DERIVATION OF TRANSFER FUNCTION OF DC SERVOMOTOR


DC servomotors are either armature controlled of field controlled. Here we will
consider a fixed field armature controlled DC servomotor and derive its transfer
function.

9|Page
10 | P a g e
MatLab code:

clc
clear all
close all
% Transfer function of DC Servomotor is given by
% 0(s)/Ea(s)= K/s(JLas^2+(RaJ+LaB)s+(RaB+KKb))
%J=moment of inertia, B=friction coeficient, K,Kb=constant
Ra=4;
La=0.00000275;
J=0.00000322;
B=0.0000035;
K=0.0247 ;
Kb=0.00247;
num=[K];
den=[J*La (Ra*J+La*B) (Ra*B+K*Kb) 0];
sys=tf(num,den);
t=0:0.001:0.2;
% Calculating Open loop Step Response
figure(1);
step(sys,t)
title('Open loop Step Response');
hold on
% Calculating Closed Loop Step Response
sys_cl=sys/(1+sys);
figure(2);
step(sys_cl,t)
title('Closed loop Step Response');

11 | P a g e
RESULT:

Closed loop Unit step response of the DC servomotor

Open loop unit step response of the DC servomotor

Hence,we have successfully used the matlab simulation to study DC servomotor


and to derive its transfer function.

12 | P a g e
QUES 6. To study 2 phase AC servomotor and derive its transfer function.
Obtain the unit step response by assuming values for the parameters present
in the transfer function.

DERIVATION OF TRANSFER FUNCTION OF 2-PHASE AC


SERVOMOTOR

13 | P a g e
MatLab code:

clc
clear all
close all
% Transfer function of AC Servomotor is given by
% 0(s)/Vc(s)= K/s(Js+B+Kb)
% K,Kb=constant, J=moment of inertia, B=friction coeficient
K=0.436;
Kb=0.00247;
J=0.00000322;
B=0.0000035;
num=[K];
den=[J B+Kb 0];
sys=tf(num,den);
t=0:0.001:0.2;
% Open Loop Step Response
figure(1);
step(sys,t)
title('Open loop Step Response');
hold on
% Calculating Closed Loop Step Response
sys_cl=sys/(1+sys);
figure(2);

14 | P a g e
step(sys_cl,t)
title('Closed loop Step Response');

RESULT:

Closed loop unit step response of AC servomotor

Open loop unit step response of AC servomotor

Hence,we have successfully used the matlab simulation to study 2 phase AC


servomotor and derive its transfer function.

15 | P a g e
16 | P a g e

You might also like