25/4/25 1:57 AM C:\Users\bhavs\...\prac6nyquistplot.
m 1 of 1
% Define the transfer function numerator and denominator
num = [0 0 0 50]; % Equivalent to 50*s^0 (DC gain)
den = [1 7 12 12]; % Denominator: s^3 + 7s^2 + 12s + 12
% Create the transfer function
sys = tf(num, den);
% Plot the Nyquist plot
nyquist(sys)
% Set the axis limits: [xmin xmax ymin ymax]
v = [-3 5 -7 7];
axis(v)
% Add labels and title
xlabel('Real Axis');
ylabel('Imaginary Axis');
title('Nyquist Plot of the system 50/(s+4)(s^2+3s+3)' )
% Determine Gain Margin, Phase Margin, Gain crossover frequency, and Phase
crossover frequency
[Gm, Pm, Wcg, Wcp] = margin(sys);
% Display results in the command window
fprintf('Gain Margin: %.2f dB\n', 20*log10(Gm));
fprintf('Phase Margin: %.2f degrees\n', Pm);
fprintf('Gain Crossover Frequency: %.2f rad/s\n', Wcg);
fprintf('Phase Crossover Frequency: %.2f rad/s\n', Wcp);