# OP-AMP Phase Margin

Discussion in 'Homework Help' started by mau80, Jun 14, 2011.

1. ### mau80 Thread Starter New Member

Oct 24, 2010
21
0
Hi to all,

For attached circuit ( OP-AMP with two resistance )
I've to find out R2 value in order to have a phase margin of 45°.
I'd like to computate wt = where |Hd(s)*Hr(s)| = 1

Can you help me in order to find out expression for:
Hd(s) and Hr(s)

Thank you very much for your great help!

Regards
Maurizio

File size:
37 KB
Views:
39
2. ### jegues Well-Known Member

Sep 13, 2010
735
43
In order to solve for R2 such that the desired phase margin is obtained first find the frequency at which the loop gain equals 0dB.

Find this same frequency, call it $f_{x}$ on the phase plot and determine the phase shift between this point, call it $p_{x}$ and the -180° point.

$p_{x} + 180 = 45$

Thus you need to chose $f_{x}$ and subsequently $p_{x}$ such that $p_{x} = -135^{o},$ use this condition to define R2.

3. ### mau80 Thread Starter New Member

Oct 24, 2010
21
0
Hi jegues,

thank you very much for your answer.

I'd like to ask some more detail about this exercise.

Ok, for comutate phase margin, I've to study open loop and find out frequency where open loop gain is 0db.

For study open loop gain I've to know Hd(s) and Hr(s).
Where:
Hd(s) is direct block transfer function
Hr(s) is feedback block transfer function

For solve this problem, I'd like to identify the feedback system:

- Vi ---> + ----> [ Hd(s) ] ------------- Vout
- ----- [ Hr(s) ] <--------- |
The exercise give to me value for Hd.
I can write Hd(s) = A / (( 1+s/p1 ) * (1+s/p2))
p1 = 1Hz
P2 = 10Hz

Now I've to comutate the transfer function for Hr(s)
Can you give me some help in this steps?

4. ### Georacer Moderator

Nov 25, 2009
5,151
1,266
Consider yourself lucky, I 'm doing the same stuff right now.
Take a read here on how to find the TF models:
http://focus.ti.com/lit/an/slyt367/slyt367.pdf
and then here to see how the closed loop gain behaves:
http://focus.ti.com.cn/cn/lit/an/slyt374/slyt374.pdf

Thus we know now that $\beta=\frac{R_i}{R_i+R_f}$

Now, let's see your open loop Bode plot:

Now, do you see that if you want to have a 45deg phase margin, your loop gain plot must reach 0 at the 10KHz mark.

Now, the loop gain is defined as $20\cdot \log (A \cdot \beta)=20\log(A)-20\log \left(\frac1\beta \right)$

It becomes now apparent that the loop gain is the distance between the open loop gain and an horizontal line on the bode plot that has a DC value of 1/β in dB.

The point where those two lines meet is where the loop gain becomes 0. Thus, in our case we can choose a β for which the $20 \log \left( \frac1\beta \right)$ line will intercept the open loop plot at the 10KHz mark.

That line is as high as 20. That means that
$\frac1\beta=10^{20/20}=10 \Rightarrow \beta =0.1 \Rightarrow\\
\frac{Ri}{R_i+R_f}=0.1 \Rightarrow R_f=9 \cdot R_i=90k\Omega{$

Is that clear?

File size:
36.9 KB
Views:
141
5. ### t_n_k AAC Fanatic!

Mar 6, 2009
5,448
783
I'm unsure about the question itself.

Is the op-amp defined in open loop as ....?

Ado=100dB, fp1=1Hz & fp2=10kHz.

If so, is this amp then configured in inverting mode with R1=10k and R2=?? for an overall resultant 45° phase margin?

That would seem to be gist of the question, although as I said I'm not certain.

In that case the open loop 's' domain function is

$A_d=\frac{A_{do} \omega_{p1} \omega_{p2}}{(s+\omega_{p1})(s+\omega_{p2})}$

$A_{do}=100,000$

$\omega_{p1}=2\pi =6.283 \ radians/sec$

$\omega_{p2}=20,000\pi =6.283 X 10^4 \ radians/sec$

When this op amp, with the aforementioned transfer function, is configured with R1 & R2 as an inverting amplifier stage, the transfer function would be

$G(s)=-\frac{R_2}{R_1+\frac{(R_1+R_2)}{A_d}}$

Running a [Scilab] simulation to extract a Bode plot for G(s) with R1=10k & R2=90k [as the nominal answer] I obtain the following ...

I would be interested if this is actually the case. Obviously I can't reconcile the result with a 45° phase margin.

File size:
32.4 KB
Views:
17
6. ### Georacer Moderator

Nov 25, 2009
5,151
1,266
@ t_n_k
A question first: Why is the phase in your diagram 180deg after the first pole? Has it increased/dropped from 0/360 to 180deg after one pole? Why does the phase drop again by 180deg after the second pole. Isn't the phase shift for one pole equal to 90deg?

If I got my theory right, when talking about phase margin, we examine the loop gain $\beta \cdot A_{OL}$. It this gain plot that we want to be zero at the desired phase shift, not the whole closed loop gain.

According to TI's second pdf (with which I agree after some math), the closed loop gain will the line in green in the following diagram:

Now, here's the trick:
The distance between the green line and the blue line is the loop gain and here's why:

The distance equals to:
$20 \log(A_{OL}) - 20 \log (A_{CL})=\\
20 \log(A_{OL}) - 20 \log \left( \frac{A_OL}{1+ \beta A_{OL} \right) =\\
20 \log \left( \frac{A_{OL}}{\frac{A_OL}{1+ \beta A_{OL}}} \right) =\\
20 \log \left(1+\beta A_{OL} \right)$

Now, $1+\beta A_{OL}$ isn't exactly equal to the loop gain, but a deviation of one unit is negligible in the logarithmic scale.

Thus, our constraint is for the loop gain to be 0 at the mark of 135deg. In other words, we want the green and the blue line to meet at the frequency at which the phase is 135deg, as I show in my diagram. In order for that to happen, we need the green line to be as high as 20dB.

The calculations are the same as in my previous post.

File size:
34.9 KB
Views:
111
7. ### t_n_k AAC Fanatic!

Mar 6, 2009
5,448
783
Thanks for the feedback Georacer

We are talking about an inverting amplifier. An ideal inverting amplifier produces a 180° phase shift. So at frequencies well below the open loop pole frequencies I would anticipate a straight 180° shift.

I'm not disputing any mathematical analysis. Rather, I was simply trying another approach using conventional transfer function operations. One plugs the variables into the equations and comes up with the closed loop transfer function which leads to a means of plotting the Bode (magnitude / phase) plot.

I'll post a more comprehensive summary of the process I followed for comment. I'm interested in coming to some resolution.

As I said, I wasn't actually sure whether the stated parameters for the amplifier were the open loop values.

BTW - I'm saddened to hear things are not great in Greece at the moment. Hope all is well with you.

8. ### Georacer Moderator

Nov 25, 2009
5,151
1,266
The specs were about the Open Loop amplifier.

Can you please explain to me how is it possible to start with 180deg phase shift (since it's an inverting amp) reach the 100Hz mark (well after the first pole) without any phase shift, and then just after one single pole @10KHz you get a 180deg phase shift? It doesn't make sense to me.
Your transfer function looks correct, but its plot does not, to me at least.

What I said earlier, and has the most significance if I have it right, is that one should not look for the gain and phase margins in the closed loop plot, but rather in the loop gain plot. The two are very different.

Thanks for your interest in my well-being. I live very close to the town centre, were the clashes and the protests take place, but they are very focused to affect me directly. However, I wish they did, since my neighborhood suffers from immigrant overflow and criminality.
In general, things are in a stalemate right now and I have no clue of what the future will bring.

9. ### t_n_k AAC Fanatic!

Mar 6, 2009
5,448
783
Ah yes - I'm missing the point about the open loop vs closed loop analysis.

Thanks for the help.

10. ### Georacer Moderator

Nov 25, 2009
5,151
1,266
You 're quite welcome.

I 'm doing the stuff right now at the uni, that's why I have them so fresh and clear in memory.

11. ### t_n_k AAC Fanatic!

Mar 6, 2009
5,448
783
Had another look to see whether the 90kΩ value for R2 made sense.

Interestingly, an accurate plot of the open loop function shows that the phase margin is 45° at a zero dB frequency of 10,002Hz and derived β=0.1414638.

This gives

R2 (or Rf)=6.0689463*R1=60.689kΩ

which seems a significant difference from 90kΩ....

Again I'm interested in whether this result is consistent.

Note: The aforementioned values were found using Scilab.

EDIT:
I also calculated the phase margin for a value of β=0.1. Again using Scilab, I found the phase margin was actually 51.835° [not 45°] at a zero dB frequency of 7861.51 Hz [not 10kHz]. This was based on an analysis of the modified open loop transfer function β*Ad.

Last edited: Jun 17, 2011
12. ### Georacer Moderator

Nov 25, 2009
5,151
1,266
Ok then, let's take a gander at the Matlab bode plot of our transfer function:

Remember that the x-axis is in rads/sec not Hz.

The 45deg margin lies at the frequency of 60Krad/sec (at about 10KHz) and has a closed loop gain of 17.4dB. That corresponds to a β of 0.135 but we won't use that for this exercise.

For the non-inverting OpAmp the closed loop-gain is
$1+\frac{R_f}{R_i}=17.4dB=7.413\\
R_f=(7.413-1) \cdot 10^4=64.13K\Omega$
.
So I guess I agree with your comment.

That should make us remember to do the extra mile and use a proper plot of the Bode diagram if we want to build a serious circuit.

Thanks for the feedback.

EDIT: I found how to plot the Bode diagram on the Hz axis, but I choose to leave the image as-is.

• ###### 17-6-2011 4-30-15 &#956;&#956;.png
File size:
32.1 KB
Views:
93
Last edited: Jun 17, 2011
13. ### t_n_k AAC Fanatic!

Mar 6, 2009
5,448
783
Indeed I agree - particularly as the OP was given an optional choice "correct" answer which is nearly 50% in error.

14. ### t_n_k AAC Fanatic!

Mar 6, 2009
5,448
783
To Georacer,

I see you use Matlab. As I said I use Scilab - a 'freebie' which does admirably well enough for me.

One of the "nice" Scilab functions related to this area is p_margin(linear system definition) which directly evaluates the phase margin for a given transfer function.

For instance, using your scale value β=0.135 with the amplifier 's' domain transfer function Ad, i.e.

$\beta A_d=\frac{13500}{(1 + 0.159170858586s + 0.000002533030s^2)}$

I can evaluate ...

[P_Margin,Zero_dB_frequency]=p_margin(βAd)

which gives

P_Margin=45.897889

and

Zero_dB_frequency=9693.3895 Hz = 60905.362 rads/sec

I guess Matlab will also have a similar function.

15. ### Georacer Moderator

Nov 25, 2009
5,151
1,266
Matlab produces a special plot after the bode(sys) command. That plot window has right click options that include phase and gain margins points on the graph, as well as their frequency at that point.
In general, matlab will always have your needs covered, even if you don't know it.

One recent example is, as I said in post#12, when I was discontent about how the plot was over rads/sec, I found another Matlab variable, the "bodeplotoptions" (I think) that contains records about how the whole plot will look.