I have a closed loop system with the corresponding gain and phase plots shown below (note frequency is normalized). I am interested in identifying the phase margin and gain margin of my system.

In order to find the phase margin, I understand that I need to find how much phase lag is needed to make my 0dB gain crossing at the -180 degrees of phase.

enter image description here

As you can see, my system looks very silly and has very low gains. How can I find the phase margin of such a system, especially where all gains are less than 0 dB?

On the contrary, in order to find my gain margin I look at points where I have -180 degree of phase and see how much gain I would need to add to get to 0dB. In this case, I have excellent gain margin (of 40 to 50 dB or more, right?).

UPDATE: Based on the helpful comments below, I was informed that I need to be looking at the open loop system to find my phase margin and gain margin. The controller is a very simple PI controller which is attempting to control the magnitude of an electric field.

Here is a plot of the open loop frequency response: enter image description here

If I am reading this plot correctly here is my take away:

Phase Margin: Looking near 0.21sample_frequency (where gain is near 0dB) it looks like I have almost no phase margin. Does this mean that 0.21sample_frequency signals may cause oscillations?

Gain Margin: Looking at 0.028*sample_frequency (where phase is near -180 degrees), it looks like I have somewhere between 5dB to 20dB of gain margin.

Am I reading the above correctly?

Thank you for reading this.

  • $\begingroup$ More information is required regarding the plant and the controller including the units used to represent input and out. If input was represented in centimeters and output in meters, it would seem as through system is giving 40dB attenuation while it may not be doing so in reality. Please edit the question to include much more details $\endgroup$
    – AJN
    Commented Aug 15, 2023 at 3:28
  • $\begingroup$ Here is a question remotely related to finding phase margin from a closed loop system. $\endgroup$
    – AJN
    Commented Aug 15, 2023 at 3:32
  • 1
    $\begingroup$ How were these plots derived? Measurements? They seem very noisy. Do you obtain the same plots if you run the same experiment twice? If not, then we cannot say anything useful about your system based on these plots. $\endgroup$
    – Chris_abc
    Commented Aug 15, 2023 at 14:21
  • $\begingroup$ Apart from what @Chris_abc said, a few more questions: 1) Is your system open loop stable? 2) What was the input fed to the openloop system which was later used to feed the frequency response estimation algorithm? 3) What estimation algorithm / library function was used? 4) what is the sampling frequency used? 4.a)Is it at least 10 times the largest value used in the x-axis of your plots? For (2) One would preferably feed a sine frequency sweep or a signal which is rich at the frequencies of interest. $\endgroup$
    – AJN
    Commented Aug 15, 2023 at 16:32
  • 1
    $\begingroup$ Thank you all. I think it will be best for me to post a new question, go over the strange system I am working with and how I can correctly obtain the open loop gain. I must crawl before I can walk. $\endgroup$
    – CakeMaster
    Commented Aug 16, 2023 at 12:36

1 Answer 1


I have a closed loop system with the corresponding gain and phase plots...

Gain and pase margins of a system are identified from the gain and phase versus frequency plots for the corresponding open loop system (after representing in unity feedback form).

Moreover, the closed loop gain plot shows that closed loop gains are below -30 dB. The phase response near 0 Hz appears to be -90 deg. Are these expected? More information is required regarding the system and how the closed loop frequency response plot was arrived at.

  • $\begingroup$ This is very much a science project on our end. We have a simple PI controller that is used to control an electric field. Our controller does what we want (most of the time) but sometimes it goes unstable for seemingly unknown reasons. I have the ability to view 8k discretely sampled input signal and the corresponding 8k output signal. I obtain the frequency response for mag/phase similar to how MATLAB uses freqz(). However I am using a python version to do this. My thought is that we have poor phase margin (or maybe gain margin) for some frequencies. $\endgroup$
    – CakeMaster
    Commented Aug 15, 2023 at 12:22
  • $\begingroup$ Please include all clarifying info directly in the question. According to this freqz is not intended for frequency response estimation. You can include the details of the python script used for the estimation in the question. I am afraid that it may not be possible to answer this question particularly since it involves unexpected hardware behavior. $\endgroup$
    – AJN
    Commented Aug 15, 2023 at 16:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.