MD SAIF ALI B210791ee Control System Assignment

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 10

MD SAIF ALI B210791ee Control system assignment Date : 28/11/23

Create a script in the MATLAB and include the results and the code as a single word document for
the submission.

(1)Create the transfer function

a) Plot the pole zero map.

Code:
numerator = 1;
denominator = conv([1, 0.5], [1, -0.5]); % (s+0.5)(s-0.5)
G = tf(numerator, denominator);
pzmap(G);
title('Pole-Zero Map of G(s) = 1/[(s+0.5)(s-0.5)]');

Result:

b) Plot the open loop system step response and display the transient and steady state response
specifications in the plot.
MD SAIF ALI B210791ee Control system assignment Date : 28/11/23

Code:
numerator = 1;
denominator = conv([1, 0.5], [1, -0.5]); % (s+0.5)(s-0.5)
G = tf(numerator, denominator);
figure;
step (G, 100);
title ('Open Loop Step Response');
grid on;
Result:

c) Calculate the closed loop system transfer function and plot the pole zero map.
Code:
numerator_open = 1;
denominator_open = conv([1, 0.5], [1, -0.5]); %
G_open = tf(numerator_open, denominator_open);
G_closed = feedback(G_open, 1);
% Display the closed-loop transfer function
disp('Closed-loop transfer function:');
disp(G_closed);
% Plot the pole-zero map of the closed-loop system
figure;
pzmap(G_closed);
title('Pole-Zero Map of Closed-Loop System');
MD SAIF ALI B210791ee Control system assignment Date : 28/11/23

Result:

d) Plot the closed loop system step response with negative unity feedback and display the transient
and steady state response specifications in the plot.
Code:

numerator = 1;
denominator = conv([1, 0.5], [1, -0.5]);
G = tf(numerator, denominator);
C = 1; % feedback gai
CL = feedback(G, C)
figure;
step(CL);
title('Closed Loop System Step Response with Negative Unity Feedback');
xlabel('Time (s)');
ylabel('Amplitude');

Result:

(2) Create the transfer function G(s) = (s+2) /s(s−2) .


MD SAIF ALI B210791ee Control system assignment Date : 28/11/23
a) Plot the Root locus. Mark the imaginary axis crossing and the breakaway points
Code:
numerator = [1, 2];
denominator = [1, -2, 0];
G = tf(numerator, denominator);
figure;
rlocus(G);
title('Root Locus Plot');
xlabel('Real Part');
ylabel('Imaginary Part'
sisotool(G);

Result:

b) Graphically obtain the gain K for which the closed-loop system has a damping ratio 0.4.
MD SAIF ALI B210791ee Control system assignment Date : 28/11/23

Result:

c) Use the SISO tool and design an appropriate compensator such that -1 + j 1.5 is part of the root
locus
Code:
% Define the transfer function
numerator = [1, 2];
denominator = [1, -2, 0];
G = tf(numerator, denominator);
sisotool(G);
-1+j1.5
MD SAIF ALI B210791ee Control system assignment Date : 28/11/23

G(s): after compensated

Result:

d) Plot the closed loop response and the characteristics like settling time and overshoot.

Settling time and overshoot is not existing


MD SAIF ALI B210791ee Control system assignment Date : 28/11/23

3) Create the transfer function

a) Sketch the Bode plot for the transfer function. Mark the phase crossover frequency and gain
crossover frequency and obtain the gain and phase margin.

Code:
numerator = 400;
denominator = conv(conv([1, 0], [1, 5]), [1, 10]); % s(s+5)(s+10)
G = tf(numerator, denominator);

% Plot the Bode plot


figure;
bode(G);
title('Bode Plot');
grid on;

% Obtain phase and gain crossover frequencies


[~, phase_crossover_freq] = bode(G);
phase_crossover_freq = phase_crossover_freq/(2*pi); % Convert to Hz
fprintf('Phase Crossover Frequency: %.2f Hz\n', phase_crossover_freq);
MD SAIF ALI B210791ee Control system assignment Date : 28/11/23

[~, gain_crossover_freq] = margin(G);


fprintf('Gain Crossover Frequency: %.2f Hz\n', gain_crossover_freq);

% Obtain gain and phase margins


[GM, PM, ~, ~] = margin(G);
fprintf('Gain Margin: %.2f dB\n', 20*log10(GM));
fprintf('Phase Margin: %.2f degrees\n', PM);

Result:

Phase Crossover Frequency: -42.84 HzGain Crossover Frequency: 18.08 HzGain Margin: 5.46 dBPhase Margin:
18.08 degrees

a) Use SISO tool and design appropriate compensator such that phase margin is 60 degrees.
Code:
numerator = 400;
denominator = conv(conv([1, 0], [1, 5]), [1, 10]); % s(s+5)(s+10)
G = tf(numerator, denominator);
sisotool(G);
MD SAIF ALI B210791ee Control system assignment Date : 28/11/23

Results:

a) Plot the Nyquist plot and assess the closed loop stability

Code:

G = tf([400], [1,15,50,0]);
% Plot the Nyquist plot
nyquist(G);
title('Nyquist Plot');
MD SAIF ALI B210791ee Control system assignment Date : 28/11/23

result:

You might also like