# Why phase margin and gain margin should be positive?

In many textbooks it's given that gain margin (in db) and phase margin of the system needs to be positive for the system to be stable. I could not find the reason behind this. Could someone explain this?

• many textbooks. Reference the textbook. Apr 15 '20 at 21:54
• What is your background, for example have you ever heard of the Nyquist stability criterion? Apr 17 '20 at 10:38

The gain and phase margins of a system are characteristics that can be obtained by studying one of the following well-known plots: Nyquist Plot, Bode Plot, Nichols Chart, Disk Margin which gives details in a different way (may be others that I'm not aware of). I will address the issue of your question by using the bode plot tool. When looking into a bode plot, one has to recognize two very crucial points. The first point is the frequency where the magnitude plot (Gain) crosses the $$0dB$$ line, also know as the gain crossover frequency. The second point is where the phase plot crosses the $$-180^{o}$$ line also known as phase crossover frequency. These points may be more than one for each case as complexity of the systems increase.

The Gain Margin of the system is the value of the magnitude plot at the phase crossover frequency and Phase Margin is the value of the phase plot at the gain crossover frequency. Gain Margin is the amount gain variation your system can tolerate before going unstable. For example consider a system with $$10dB$$ gain margin at the frequency $$15rad/sec$$, which means that at $$15rad/sec$$ the phase plot crosses the $$-180^{o}$$ line. Now, if in reality there is some gain (decreasing) variation of $$-10.5dB$$ at $$15rad/sec$$, then due to the fact that this frequency is a phase crossover frequency your system would go unstable. The same goes for phase margin as well.

A classical feedback system has a transfer function oof the form:

$$T(s) = \frac{L(s)}{1+L(s)} \rightarrow Negative \ Unity \ Feedback$$

$$T(s) = \frac{L(s)}{1-L(s)} \rightarrow Positive \ Unity \ Feedback$$

The sign of the unity feedback changes and becomes positive when the phase of the system crosses the $$-180^{o}$$ line and becomes:

$$Phase < -180^{o}$$

and goes back to negative sign when the phase of the system is again $$\ Phase > -180^{o}$$. The critical fact regarding the sign of the feedback is at the region close to and around the gain crossover frequency (or the regions around the gain crossover frequencies if there are more than $$1$$ points where the magnitude plot crosses the $$0db$$ line). In order for your system to be stable you basically need it to be at negative unity feedback state, which means the system's phase should be $$\ Phase > -180^{o}$$. So, when talikng about the necessity of positive phase margin, we are talking about the regions close to a gain crossover frequency where the system should be in the negative unity feedback state $$\ \Rightarrow \ Phase > -180^{o}$$.

The phase margin of the system can be negative and the stability of the system is preserved as long as this happens at frequencies which are nowhere near any gain crossover frequency. I will borrow a very good image from an anwer at Quora which illustrates this very beautifully:

At the first region which is highlighted in red around $$1kHz$$ the system has negative phase margin and negative gain margin but it remains stable since we are not close to a gain crossover frequency. At the second region highlighted in red around $$100kHz$$ the system goes again at positive unity feedback state with negative phase margin and positive gain margin yet it is still stable since again we are not close at a gain crossover frequency. Note that at the gain crossover frequency the phase margin is indeed positive in order for the stability of the system to be preserved.

In conclusion, regardless of the sign of the margins you have to check the region where these changes occur and whether or not the magnitude plot is close to $$0dB$$. I chose the bode plot tool since it is somehow less complicated and more popular than the others I mentioned but I strongly encourage you (without underestimating bode plot at all) to check out both Nyquist Plot and Nichols Chart (which I very much like) since they provide information in a very elegant and representative way. You should also search for the disk margin since it copes with the problem of variations which can cause both phase and gain variation simultaneously and it shows you how robust is your system ar such variations.