# How to find gain and phase margin from transfer function without Nyquist or Bode plot

Given transfer function L(s) as a ratio of polynomials of s, I know that we can find gain margin (GM) and phase margin (PM) by using a Nyquist or Bode plot.

From a Nyquist plot:

1. Find a point where the Nyquist plot of L(jw) crosses negative x axis, then GM=1/|L(jw)| at that point.
2. Draw a circle from origin with radius 1, and find an intersection of Nyquist plot of L(jw) with unit circle. PM is the smallest angle that is required for Nyquist plot to be rotated clock-wise in order for that point on intersection to touch -1 on x axis.

From a Bode plot: here is an answer.

Question: Lets say I am not able to plot Nyquist and Bode plots, but I need to find GM and PM.

1. Is there any way to find exact GM and PM?
2. Is there any easy way to approximate it?
• In what format do you have L(s) ? As a ratio of polynomials of s or as a lookup table of frequency versus gain and frequency versus phase or some other format? Please give a sample in the question.
– AJN
Commented May 24, 2021 at 7:23

## 1 Answer

Exact gain margin and phase margin finding requires us to find the roots of polynomials of $$\s= 0 + j \omega\$$1 constructed from the numerator and denominator polynomials of the transfer function.

Finding exact roots of high order polynomial is not possible AFAIK. But the roots can be found to very very accurate values using numerical methods. Numerical analysis software often have a roots function which can be used to find the roots numerically.

For example, to find phase margin, the equation to find the gain cross over frequency is,

$$|N(s)| - |D(s)| = 0$$

Where $$\N, D\$$ are the numerator and denominator polynomials of the open loop transfer function.

If allowed to use matlab, you can directly use the allmargin command if the transfer function or some other representation of the system is known.

Is there any easy way.

You can probably reduce the order of the system and make the polynomials lower order. But, if you are using a fast computer, it may not be worth the effort.

1 $$\s = \sigma + j \omega\$$ and lies on the typical s plane contour.

• Any introductory text book on classical control theory will cover the detailed steps to calculate the margins without drawing a diagram. It boils down to constructing the necessary polynomial and then finding it roots and then substituting the roots back into the openloop transfer function.
– AJN
Commented May 24, 2021 at 7:45
• I want to formulate some problem like: given L(s) such that 1+L(s) is stable, for what values of k we will get 1+k*L(s) also stable. What is the name for such types of problem? I want to find some references to read
– Lee
Commented May 24, 2021 at 7:52
• This is significantly different from the actual question asked. Read upon root locus. That method is also numerical for high order transfer functions. But well covered in the literature.
– AJN
Commented May 24, 2021 at 8:10
• You can use gain margin also for this purpose mentioned above.
– AJN
Commented May 24, 2021 at 8:11