CS Manual
CS Manual
IVSemester
Control Systems
Course Code BEC403 CIE Marks 50
Teaching Hours/Week(L:T:P) (3:0:2) SEE Marks 50
Total Hours of Pedagogy 40 hours Theory + 12 Lab slots Total Marks 100
Credits 04 Exam Hours 03
clc;
close all;
clear;
p = 4;
q = [1 1 2];
disp('Transfer Function a:');
a = tf(p, q)
r = [1 0];
s = [1 2];
disp('Transfer Function b:');
b = tf(r, s)
disp('Series Connection of a and b (c):');
c = series(a, b)
disp('Feedback System (Ans):');
Ans = feedback(c, 1, -1)
OUTPUT:-
Transfer Function a:
a=
s^2 + s + 2
Transfer Function b:
b=
s+2
Page 1
CONTROL SYSTEM [BEC403]
c=
4s
s^3 + 3 s^2 + 4 s + 4
Ans =
4s
s^3 + 3 s^2 + 8 s + 4
Page 2
CONTROL SYSTEM [BEC403]
clc;
close all;
clear all;
% Define the Laplace transform variable s
s = tf('s');
% Define the individual transfer functions
P1 = 1/(s+1);
P2 = 2/(s+2);
L1 = -1/(s+3);
L2 = -1/(s+4);
% Calculate the combined loop transfer functions
L12 = L1 * L2;
% Calculate the determinant Delta
Delta = 1 - (L1 + L2) + L12;
% Calculate Delta1 and Delta2
Delta1 = 1 - (L1 + L2); % Assuming the same form for Delta1 and Delta2
Delta2 = Delta1; % Assuming Delta2 is the same as Delta1
% Calculate the overall transfer function using Mason's Gain Formula
TF = (P1 * Delta1 + P2 * Delta2) / Delta;
% Display the overall transfer function
disp('Overall transfer function of the system using Masons Gain Formula:');
display(TF);
OUTPUT:
TF =
3 s^9 + 94 s^8 + 1293 s^7 + 10243 s^6 + 51460 s^5 + 169827 s^4 + 367528 s^3 + 501696 s^2
+ 390528 s + 131328
s^10 + 33 s^9 + 484 s^8 + 4150 s^7 + 23005 s^6 + 85993 s^5 + 219006 s^4 + 374080 s^3 +
408384 s^2 + 255744 s + 69120
Page 3
CONTROL SYSTEM [BEC403]
OUTPUT:
-3.0000 + 0.0000i
-0.5000 + 1.3229i
-0.5000 - 1.3229i
-1.0000 + 1.4142i
-1.0000 - 1.4142i
Page 4
CONTROL SYSTEM [BEC403]
Page 5
CONTROL SYSTEM [BEC403]
4 Implement time response specification of a second order Under damped System, for
different damping factors.
clc;
clear all;
close all;
% Define the numerator and denominator of the transfer function
num = [8];
den = [1 3 8];
% Create the transfer function
sys = tf(num, den);
step(sys, 0:0.01:10);
title('Step Response of the System');
[r, p, c] = residue(num, den);
natural_frequency = sqrt(den(3));
damping_ratio = den(2) / (2 * natural_frequency);
disp('Damping Ratio:');
disp(damping_ratio);
OUTPUT:
Damping Ratio:
0.5303
Page 6
CONTROL SYSTEM [BEC403]
clc;
clear all;
close all;
num1 = 1;
den1 = [1 1.414 1];
w = 0:0.01:pi;
h = freqs(num1, den1, w);
mag = abs(h);
phase = angle(h);
figure;
subplot(2,1,1);
plot(w, mag);
xlabel('Frequency');
ylabel('Magnitude');
title('Magnitude Spectrum of H1');
grid on;
subplot(2,1,2);
plot(w, phase);
xlabel('Frequency');
ylabel('Phase');
title('Phase Spectrum of H1');
grid on;
OUTPUT:
Page 7
CONTROL SYSTEM [BEC403]
% Define the time constants for the lead and lag components
T_lead = 0.1; % Lead time constant
T_lag = 10; % Lag time constant
Page 8
CONTROL SYSTEM [BEC403]
OUTPUT:
Page 9
CONTROL SYSTEM [BEC403]
7 Analyze the stability of the given system using Routh stability criterion.
Page 10
CONTROL SYSTEM [BEC403]
OUTPUT:
>> exp7
System is stable
>> exp7
Page 11
CONTROL SYSTEM [BEC403]
OUTPUT:
ans =
s (s+2) (s+1)
Page 12
CONTROL SYSTEM [BEC403]
OUTPUT:
Page 13
CONTROL SYSTEM [BEC403]
OUTPUT:
Page 14
CONTROL SYSTEM [BEC403]
OUTPUT::
Page 15
CONTROL SYSTEM [BEC403]
clc;
clear;
Page 16
CONTROL SYSTEM [BEC403]
OUTPUT:
Transfer function for PI controller without feedback:
sys2 =
10 s + 10
s^3 + 2 s^2 + s
G2 =
10 s + 10
s^3 + 2 s^2 + 11 s + 10
k=
Page 17
CONTROL SYSTEM [BEC403]
% PD controller parameters
Kd = 10;
Kp = 10; % Assuming Kp = Kd for simplicity, you can change this as needed
% Step response
m = step(G1);
figure;
plot(m);
title('PD control Kp=10 and Kd=10');
xlabel('Time (seconds)');
ylabel('Amplitude');
grid on;
OUTPUT:
sys1 =
10 s + 10
s^2 + 2 s + 1
Page 18
CONTROL SYSTEM [BEC403]
G1 =
10 s + 10
s^2 + 12 s + 11
Page 19