# controls - how to measure phase margin for low gain system

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. 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: 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?

• 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
– AJN
Aug 15 at 3:28
• Here is a question remotely related to finding phase margin from a closed loop system.
– AJN
Aug 15 at 3:32
• 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. Aug 15 at 14:21
• 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.
– AJN
Aug 15 at 16:32
• 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. Aug 16 at 12:36

• 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.