Is there a way to label the disk margin on a Nyquist Plot?
18 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I can't seem to figure out how to label the gain and phase margins on the bode plot, or how to label the disk margin on the nyquist plot.
Anyone know of a way to do this? I can get the gain and phase margins from the margins function, but would like to be able to show them
on the afctual plot.
clear all; close all; clc;
k_num = 10;
k_den = [1 10];
K = tf(k_num, k_den);
g1_num = [-10^-4 10];
g1_den = 1;
g2_num = 9;
g2_den = [-1 -0.1];
G1 = tf(g1_num,g1_den);
G2 = tf(g2_num,g2_den);
G = G1-G2;
openloop_transfer_function = G*K;
% Part A Sensitivity and Complimentary Sensitivity functions.
% Output to command window.
Sensitivity_Function = 1/(1+(G*K))
Complimentary_Function = (G*K)/(1+(G*K))
% Part B Closed loop poles.
% Output to command window.
closedloop_poles = pole(Complimentary_Function);
fprintf('Closed Loop Poles\n\n');
fprintf(' %f + %fj Stable\n',...
real(closedloop_poles(1)),imag(closedloop_poles(1)));
fprintf(' %f + %fj Stable\n',...
real(closedloop_poles(2)),imag(closedloop_poles(2)));
fprintf(' %f + %fj Stable\n',...
real(closedloop_poles(3)),imag(closedloop_poles(3)));
fprintf(' %f + %fj Stable\n\n',...
real(closedloop_poles(4)),imag(closedloop_poles(4)));
% Part B System Stability.
% Output to command window.
fprintf('System Stability = ');
stability = isstable(Complimentary_Function);
if stability == 1
fprintf('System is stable\n\n')
else
fprintf('System is unstable\n\n')
end
% Part C Time Delay Margin.
% Output to command window.
[Gm,Pm,Wcg,Wcp] = margin(openloop_transfer_function);
Phase_Margin = Pm;
Omega = Wcp;
Time_delay = Phase_Margin/Omega;
fprintf('Time Delay Margin = %f\n\n', Time_delay);
% Part D Display Bode Plot with Gain and Phase Margins Labeled.
figure(1)
margin(openloop_transfer_function)
grid on
% Part E Display Nyquist Plot with Disk Margin Labeled.
figure(2)
n = 1000;
theta = linspace(0, 2*pi, n);
x = cos(theta);
y = sin(theta);
nyquist(openloop_transfer_function);
hold on;
plot(x-1, y);
0 Kommentare
Antworten (0)
Siehe auch
Kategorien
Mehr zu Stability Analysis finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!