Is there a way to label the disk margin on a Nyquist Plot?

조회 수: 9 (최근 30일)
Terry Poole
Terry Poole 2020년 10월 28일
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개)

카테고리

Help CenterFile Exchange에서 Frequency-Domain Analysis에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by