How Matlab calculate MARGIN (Problem with system with time-delay)
Show older comments
Hi,
I'm calculating dependence of critical parameters (for Ziegler-Nichols method) on the size of the time-delay. For example I have first order system sys=3/(s+1) and I'm adding different time-delays like this sys.iodelay=Ts/2. I have vector of these delays Ts=logspace(-3,1, 10000) (10000 values between 10^-3 and 10^1). I was using command [Gm,Pm,Wgm,Wpm] = margin(sys) to calculate dependence of GM and Tkrit=2*PI/Wgm on the size of the time-delay. I got something like this:

First graph is ZOOMED dependence of GM on time-delay Ts/2 and second is dependence of Tkrit=2*PI/Wgm on time-delay. You can see this steps/peaks in the graph. I found that this is because of MATLAB calculate more than one GainMargin for higher Ts (This is due to repeating -180° phase every 2PI or 360° cycle, because of infinity phase caused by time-delay). Before that peak MATLAB takes first GM in array but after the peak it is taking second GM of the array. I bypassed it using this code:
Fs.iodelay=ts/2;
M = allmargin(Fs);
KK(i)=M.GainMargin(1);
TK(i)=2*pi/M.GMFrequency(1);
Where I require to take only first GM (which I believe is on frequency when phase is -180°). This solved this one problem, but still in particular time-delay Ts=T*PI/100 (where T is time constant of system)i have one little peak (see picture):

What I found was: before the step MATLAB found only one GM (at the required frequency when phase is -180°), in the peak MATLAB found again only one GM (BUT ON HIGHER FREQUENCY THAN ITS WHEN PHASE IS CROSSING -180°!!!), after the peak it found 2 GainMargin's (one on frequency for -180° and one on higher frequency) and because of my code it took first (which is for -180°phase), so my question is: WHY MATLAB CANT SEE GAINMARGIN AT FREQUENCY WHEN PHASE CROSS -180° FOR THIS INTERVAL OF TIME-DELAYS=Ts/2? (interval starts with Ts=T*PI/100 and end approximately after 1.2ms.
Answers (1)
Sulaymon Eshkabilov
on 20 May 2019
0 votes
This is a sampling time related issue. Solution is to reduce a sampling time size.
Categories
Find more on Control System Toolbox in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!