Measure Phase/Gain Margin from a different phase reference using margin()?
Show older comments
I'm attempting to plot a bode diagram with phase and gain margins labeled using the margin() function. My transfer function is inverting - thus, its phase starts near 180°. When margin() is called, it plots the system properly. However, it measures the gain and phase margins with respect to 180° instead of 0° or 360° (the inversion points for an initially inverting system). How can I measure the margin distances from a different reference phase?
For instance, in the code below the phase margin is measured as -142° (that is, 142° below 180°). However, the true phase margin is around 38° (that is, the phase distance remaining before the system is inverted at 0°). Is this problem occuring becuase the phase doesn't start at exactly 180°? (That's another problem I'm not sure how to solve).
Here's my code (I'm using symbolic expressions to setup the transfer function):
clc; clear; close all;
% setup symbolic evaluation of transfer function
syms s
T0 = sym(-97.74e3); % T0, the DC loop transmission
f0 = sym(5); % system's first pole in Hz
f1 = sym(5e6); % system's second pole in Hz
fs = sym(286.2e3); % additional stray pole
Ts = T0*(1/(1+s/(2*pi*f0)))*(1/(1+s/(2*pi*f1)))*(1/(1+s/(2*pi*fs))); % loop transmission
pretty(Ts)
% preprocess the symbolic expression for use in a tf object
Ts = expand(Ts); % expand into polynomial
[symNum,symDen] = numden(Ts); % separate numerator and denominator
num = sym2poly(symNum); % convert to array of coefficients
den = sym2poly(symDen);
% set the options for the Bode plot
options = bodeoptions;
options.FreqUnits = 'Hz'; % set Bode plot units of frequency to Hz
options.Grid = 'On'; % plot with a grid for easier viewing
options.XLim = [1, 1e9]; % set frequency plotting range
% plot with phase and gain margins labeled
sys = tf(num, den);
margin(sys, options)
Accepted Answer
More Answers (0)
Categories
Find more on Stability Analysis in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!




