You are on page 1of 4

Lab 2 - Question 1

clc
clear all

% Define Transfer function G(s)


G = tf([5], [1 1])

G =

5
-----
s + 1

Continuous-time transfer function.


Model Properties

% Define Transfer Function H(s)


H = tf([1 6 5], [1 6 11 6])

H =

s^2 + 6 s + 5
----------------------
s^3 + 6 s^2 + 11 s + 6

Continuous-time transfer function.


Model Properties

% Define the Transfer Function T(s)


T = G / (1 + G*H)

T =

5 s^4 + 35 s^3 + 85 s^2 + 85 s + 30


-----------------------------------------
s^5 + 8 s^4 + 29 s^3 + 69 s^2 + 78 s + 31

Continuous-time transfer function.


Model Properties

% Question 1(a)
% Plot the Step Response on figure 25
figure(25);
step(T);
title('Step Response of T(s)');

1
% Question 1(b)
% The order of the system is he highest power of s in the denominator of
% the transfer fuction.

% Denominator of T(s) = s^5 + 8s^4 + 29s^3 + 69s^2 + 78s +31


% Order = 5

% Question 1(c)

poles_T = pole(T);
zeros_T = zero(T);

disp('Poles: ');

Poles:

disp(poles_T);

-3.9360 + 0.0000i
-1.0320 + 2.6098i
-1.0320 - 2.6098i
-1.0000 + 0.0000i
-1.0000 - 0.0000i

disp('Zeros: ');

2
Zeros:

disp(zeros_T);

-3.0000 + 0.0000i
-2.0000 + 0.0000i
-1.0000 + 0.0000i
-1.0000 - 0.0000i

% Question 1(e)
% Obtain the step response and time vector
[y, t] = step(T);
[ymax, tmax] = max(y)

ymax = 1.7022
tmax = 16

% Calculate overshoot
yss = y(end); % Assuming steady state is reached
OS = (ymax - yss) / yss * 100; % Overshoot fourmula

% Plot the system response


figure(53);
plot(t, y, LineWidth=2);
hold on;
plot(t(tmax), ymax,'ro', 'MarkerSize',10, 'MarkerFaceColor','r');
hold off;

xlabel('Time (\it{t})');
ylabel('System Response');
title(['System Response with Overshoot:']);
legend('System Response', 'Overshoot Point');
grid on;

3
4

You might also like