# How is gain margin defined for this control system?

Lets say there is a system

H(s) = 3/s

which I want to control with a controller

G(s) = Kp·(1+10/s) The Bode diagram of the open loop G(s)H(s) with Kp=1 is: At the transit frequency the phase is about -150°, which gives a phase margin of 30°.   Decreasing K makes the phase reserve smaller and ringing is increased: Q1: I understand this behavior, but usually it is said that by increasing Kp the system gets more unstable, but here the opposite is the case. So why is there a "discrepancy"?

Q2: (This is the main question): How is gain margin defined here? In my opinion, GM is infinite, because gain can be increased infinitely without making the system unstable.

EDIT: LTSpice simulation of the same system  • Please draw the system diagram so there is zero ambiguity on what the graphs represent. Oct 1, 2022 at 10:32
• What do you mean? The Bode Plot above? It is G(s)H(s) with KP=1. "The bode diagram of the open loop G(s)H(s) with KP=1 is: ..." The other graphs are not really relevant, but they are the responses to a unit step at the reference input of the control system. Oct 1, 2022 at 11:29
• I added the system diagram above Oct 1, 2022 at 11:37
• The loop gain should be -GH instead of +GH as you have assumed. Everything will be fine then. Just replot it in MATLAB. Oct 1, 2022 at 16:34
• No, you have plotted GH in figure 1. The loop gain that you have plotted should be -GH, and the phase response of the loop gain should decrease with frequency. Oct 2, 2022 at 11:05

The product of the transfer functions gives (as shown in the diagram) a phase shift of 180° at very low frequencies (including DC). This results from the unrealistic assumption of ideal integrators. That means: With a minus sign at the summing junction, we have a problem (positive feedback for DC - no operational point).

The circuit works only with (at least) one real integrating function. Only in this case, we can evaluate the stability properties of the closed loop.

Independent on this, the loop gain for a realistic second-order circuit can never reach a phase shift of 180° at a finite frequency.

• @MichaelW It looks like you have an extra $s$ in there, because I get $GH/(1+GH)=3K_p(s+10)/(s^2+3K_ps+30K_p)$ (given your first two transfer functions). Oct 1, 2022 at 17:45
• @MichaelW Which sign do you assume at the summing junction? Can you always trust simulation results - in particular, when the gain of a block approaches infinity? As soon as it automatically assumes any finite (large) number we have a lowpass and not an ideal integrator function. My simulation results for the closed loop are identical to the diagram as shown above - however, assuming a lowpass function with a cutoff at 100µHz (mikro!). Hence, we have 180deg phase shift at the summing junction for DC.
– LvW
Oct 2, 2022 at 8:18
• MichaelW - sorry, there is a typing error in my comment above (last line). Of course, for a stable bias point the phase shift at the summing junction must be zero deg - as provided by REAL integrators (lowpass). Only in this case we have negative DC feedback. Fortunately, books have not to be rewritten.
– LvW
Oct 2, 2022 at 9:17
• I agree - from the pure mathematical point of view, the phase shift of both blocks together is 180 deg (at very low frequencies, including DC). So - what happens when the loop is closed (with a minus sign at the summing point)? The total phase shift is 360 (zero) deg, is it not? So we have positive feedback - or not? Therefore, I expect problems (instability). However, simulation results show a stable system. What is your explanation?
– LvW
Oct 2, 2022 at 9:26
• Exactly this was my point! According to the stability criterion the closed-loop cannot be stable (positive feedback at f=0). But this is pure theory! In reality we have no ideal integrators with infinite gain at f=0. And that´s what the simulation programs do - they assume a finite gain - otherwise they could not show the results above. Thats all I wanted to make clear - nothing else!
– LvW
Oct 2, 2022 at 9:36

Q1: I understand this behavior, but usually it is said that by increasing Kp the system gets more unstable, but here the opposite is the case. So why is there a "discrepancy"?

For systems with a low pass characteristic this is generally true. However, for an arbitrary type of system you cannot generalize it like this. Stability depends on both phase and magnitude, and Kp only influences the magnitude.

Q2: (This is the main question): How is gain margin defined here? In my opinion, GM is infinite, because gain can be increased infinitely without making the system unstable.

Gain margin is defined as the amount of gain (amplification) needed to bring your system into instability. For your system $$\H(s) = \frac{3}{s} \$$ the gain margin is infinite because the critical point (0dB magnitude and -$$\180^\circ\$$ phase) is never reached. I don't see why you intend to use an integrator in your control loop. Here is the step response with a Kp = 10 in the forward branch, and it looks pretty fast.

s = tf('s');
H = 3/s;
Kp = 10;
Hcl = feedback(H*Kp,1);
step(Hcl)
` • The question goes back to a school example, which was given by a teacher for exactly the same system: It was asked how to chose Kp the PI controller to achieve a given gain margin. Apparently he made a mistake here, because in this case there is no gain margin defined. Oct 2, 2022 at 14:49

Q1: ... usually it is said that by increasing Kp the system gets more unstable, but here the opposite is the case.

Yes, because there is a "little" problem.

A "differentiator" is included in the "G" function ...