This makes a lot more sense now! so if I plot and for each range I look at the point where the gain is 0db (i.e gain = 1) and the phase margin is not near -180 degrees, then my circuit is fine, but if it is near or below -180 degrees at that point, then the circuit oscillates. correct?
Yes.
As shown in the examples above the phase axis is phase margin. You should have a phase margin greater than 45 degrees when the gain is 0dB.
Gain margin is the negative gain (attenuation) when the phase margin is 0 degrees. It should be -6db or more attenuation.
If you have a single dominant pole both of these conditions are met.
In the example I gave the dominant pole comes from the opamp.
The opamp gain phase response is given in the datasheet:
The gain is -4dB at 1MHz.
The simple circuit, in my previous message, measures -9dB at 1 MHz. The divider, R1 and R2 provides -6dB of loop gain.
There is a 1dB difference between the model and the datasheet.
If I introduce capacitor C1:
There is now a pole at the frequency
F = 1/(2 x pi x (R1 in parallel R2) x C1)
= 31.8 kHz
If I measure the response:
I get -6dB at 31.8kHz, 0db because the RC filter is at 31.8kHz and -6dB from the divider for a total of -6dB.
In this case the circuit behavior is determined by the passive parts, not the opamp.
Regards,
Jay_Diddy_B