Control System Lab Mannual-1
Control System Lab Mannual-1
FUNCTION.
% Define the transfer function numerator and denominator coefficients
numerator = [1 1 3]; % coefficients of numerator
denominator = [1 2 1]; % coefficients of denominator
% Create a transfer function object
tf_sys = tf(n, d);
% Plot the poles and zeros of the transfer function figure;
pzmap(tf_sys);
title('Poles and Zeros of the Transfer Function');
In the above transfer function, the power of 's' is two in the denominator. That is
why the above transfer function is of a second order, and the system is said to
be the second order system
CODE:
e1=0.2;
wn=5;
n1=[wn^2];
d1=[1 2*e1*wn wn^2];
c1=tf(n1,d1);
t=0:0.01:5;
subplot(2,2,1);
step(c1,t);
grid;
e2=0.5;
wn=5;
n2=[wn^2];
d2=[1 2*e2*wn wn^2];
c2=tf(n2,d2);
t=0:0.01:5;
subplot(2,2,2);
step(c2,t);
grid;
e3=0.7;
wn=5;
n3=[wn^2];
d3=[1 2*e3*wn wn^2];
c3=tf(n3,d3);
t=0:0.01:5;
subplot(2,2,3);
step(c3,t);
grid;
e4=0.9;
wn=5;
n4=[wn^2];
d4=[1 2*e3*wn wn^2];
c4=tf(n4,d4);
t=0:0.01:5;
subplot(2,2,4);
step(c4,t);
grid;
figure(2)
step(c1,c2,c3,c4,'r--');
title('comparision of all the under damped responses');
legend({'e1=0.2','e2=0.5','e3=0.7','e4=0.9'});
legend('boxoff');
grid;
Explanation :
1. e1 = 0.2;
o Defines the damping ratio (ζζ) for the first system as 0.20.2.
2. wn = 5;
o Defines the natural frequency (ωnωn) as 5 rad/s5rad/s.
3. n1 = [wn^2];
o Defines the numerator of the transfer function as ωn2=25ωn2=25.
4. d1 = [1 2*e1*wn wn^2];
o Defines the denominator of the transfer function
as [1,2ζωn,ωn2]=[1,2,25][1,2ζωn,ωn2]=[1,2,25].
5. c1 = tf(n1, d1);
o Creates a transfer function object c1 using the numerator (n1) and
denominator (d1).
6. t = 0:0.01:5;
o Defines a time vector t from 00 to 55 seconds with a step size
of 0.010.01.
7. subplot(2, 2, 1);
o Creates a 2x2 grid of subplots and selects the first subplot for
plotting.
8. step(c1, t);
o Computes and plots the step response of the system c1 over the
time vector t.
9. grid;
o Adds a grid to the plot for better visualization.
EXPERIMENT NO 5: IMPLEMENT FREQUENCY RESPONSE OF A SECOND ORDER
SYSTEM.
zeta = 0.1; % damping ratio
omega_n = 10; % natural frequency
omega = logspace(-1, 2, 100);
H = (omega_n^2) ./ (omega.^2 - 2*zeta*omega_n*1i*omega +omega_n^2);
magnitude = abs(H);
phase = angle(H);
subplot(2,1,1);
loglog(omega, magnitude);
xlabel('Frequency (rad/s)');
ylabel('Magnitude');
title('Frequency Response - Magnitude');
grid on;
subplot(2,1,2);
semilogx(omega, rad2deg(phase));
xlabel('Frequency (rad/s)');
ylabel('Phase (degrees)');
title('Frequency Response - Phase');
grid on;