Indeed, two phase crossovers are occurring. The first phase crossover is at w = 0 rad/s with Gm = - Inf dB and the second is at w = + Inf rad/s with Gm = + Inf dB.
When there are multiple gain and/or phase margins for a certain transfer function, use of the function "allmargin" is advised. If you execute "allmargin", you get the below output:
>> allmargin(sys)
ans =
struct with fields:
GainMargin: [0 Inf]
GMFrequency: [0 Inf]
PhaseMargin: 78.5788
PMFrequency: 1
DelayMargin: 1.3715
DMFrequency: 1
Stable: 1
In the above output, "allmargin" returns both Gain Margins [0 Inf] (in absolute units) and their respective crossover frequencies [0 Inf].
The reason why "margin" only returns Gain Margin equal to 0 is due to the following:
In situations where there are two gain margins, "margin" returns the smallest gain change needed to cause instability, which is the value closest to Gain = 1 (i.e., no change). So if "allmargin" returns [0.9 1.5], for example, 0.9 wins because it is a smaller relative change (-10%) than 1.5 (+50%). The function was designed in this way under the assumption that, in most instances, control systems designers are usually interested in how close/far they are from instability. So, the lower gain margin value indicates the smallest margin to instability.
In the example transfer function we are dealing with in this post, there are two crossovers frequencies (0 and +Inf) with corresponding factors Gm = 0 and Gm = Inf. Both are equally far from Gain = 1 in log scale so it is a tie. "margin" could theoretically return -Inf dB or +Inf dB. But, since it is a tie, the algorithm returned the lower value in absolute terms. In these situations, the use of "allmargin" is ideal as it is meant to give the fuller picture.
Best Answer