Re: feedback & stability (long)



Paul,
if you wrote this article yourself, I really admire your technical writing
tallent!

Perhaps the same transient response observation method can be used on the
low frequencies (LF). Apply 1Hz rectangular signal to the input and observe
the output. In a good amplifier it shall respond by neat exponential "teeth"
(alternating polarity) on each edge of the input signal, with some
overshoot. If you see prolonged undulation, like a swell on the sea, it is a
problem.

Feedback widens LF bandwidth to a few Hz. It is useless, causing nothing but
rumble overloading tubes and magnetizing the transformer for no purpose. In
this case I usually deepen feedback at LF just below mechanical resonance of
a speaker by connecting a series RC (say 47uF + 120ohm) in parallel to the
first stage cathode resistor where the feedback is applied. Now while the
transformer is rolling off, this circuit is rising loop gain up,
compensating phase advance of the transformer. In this configuration, output
impedance is maintained low at LF, helping damping speaker resonance better.

The dominant null now can be an interstage cap (set to about 30...40Hz
cut-off), not the transformer. (There is no need to select an enormous
interstage capacitor.) At 3...4Hz open loop gain will gently cross 0dB with
ample phase margin.

Regards,
Alex

"Paul G." <paulguy@xxxxxxxxxxx> wrote in message
news:0q4n64tdkl1g0ar98vfoppi9ogfpj3vdg9@xxxxxxxxxx
Here's a rather long blurb on feedback and stability. I'm not too
sure if it's too simple or too complicated! There's probably all kinds
of mistakes, please check it out for screw-ups. Since there are ASCII
schematics and diagrams, you'll need to view it with a fixed width
font like "new courier".

INTRODUCTION
............................
You have built an amplifier, or are planning one and you decide
that maybe you should employ feedback. Feedback is a mechanism where
you use excess gain in an amplifier to reduce "bad things" that are
generated within the amplifier circuit. Those "bad things" are
distortion, noise, poor frequency response, phase shift - anything
that wasn't present in the input signal.
Feedback has limitations. At the extreme ends of the amplifiers
frequency response, those "bad things" can be made WORSE, often to the
point where the amplifier decides to become a signal generator, at
maximum possible output level.
The art in using feedback is to maximize the amount of feedback in
the audio spectrum (or range of frequencies that have your interest),
and minimize the nasty effects where feedback makes things worse.
There are a number of designs that avoid feedback in any measure,
it is very difficult to avoid since many circuits and devices have
"built-in" feedback. Triodes have built in feedback from plate to grid
(pentodes eliminate that by using a screen grid to shield the main
grid, thereby getting higher power gain). "Follower" topologies use
feedback. Since these circuits wrap the feedback around just one gain
stage, they are considered fairly benign. The evil feedback usually
encompasses 2 or more gain stages.
Poor feedback practices can cause any number of headaches, and
when components, loads, or input signals are altered or undergo
changes, the circuit can do some very unexpected behaviour.

First I'll try to go through the feedback theory.

Second I'll show how I set up feedback using a minimum of
equipment and time. This method uses a lot of trial and error (adding
components and tweaking them for best response). Remember, trial and
error is a VERY powerful design technique, and should never be
dismissed!

Thirdly I'll go the whole 9 yards with Bode plots, Nyquist
criteria, etc. This explains all the weird things that you would have
used trial and error to solve, and it will allow you to do the
complete design, providing that you know in detail all the circuit
behaviour and parameters. Knowing that detail, and making many
measurements make this 3rd method unacceptable (IMHO).

....You don't need Microsoft Excel for most of this, but it is handy
for publishing the results, and is one of the easier ways to graph
Nyquist diagrams. Otherwise graph paper, or just the list of
measurements should do fine.

THEORY
............................
I will make use of ASCII circuits, to see them you will need to
change your font to a fixed width font like "Courier New". I will use
"beta" or "B" as a positive value (not like Radio Designers Handbook
ed.4 -RDH4), and will use a summing point with inversion as is more
commonly used in today's textbooks.
Here's the generic feedback configuration:


summing point .--------------.
+ |Amplifier |
input ---------------(X)------>|gain= A |->---------- output
Vin - | Va | | | Vout
| '--------------' |
| .--------------. |
| |feedback | |
feedback '------<-|network |<---------'
voltage |I/O ratio= B |
Vfb=B*Vout '--------------'

The summing point (X) adds the input and subtracts the feedback
signal. In many circuits, the + point is the grid or transistor base,
and the - point is the cathode or emitter. With an op-amp, they could
be the inverting or non-inverting inputs. The summing point could also
be a simple node (junction) if you are using current instead of
voltage. I'll use the more common voltage feedback, derived directly
from the output (it samples output voltage). With different
topologies, you need to redo the math, especially if you are deriving
the feedback from load current or/and using current summing at the
input. There are "rules of thumb" when you use those topologies, but
don't trust 'em...... do a bit of math to make sure.
The amplifier is your amp..... with all its warts. Its gain is "A".
Va is the input voltage to the amp (after the summing point). You can
consider this as a single number at mid-band, but it must be expressed
as a complex number or "phasor" as you get to the extreme ends. I
prefer to use "phasors", they're easier. A phasor is simply a number
PAIR, the amplitude and the phase difference between amp input and
output. It's much like the wind measurement.... 40km/hr isn't much use
by itself to a sailor, until they add "from NE", in which case it's a
useful value. The complex pair equivalent would be a 14km/hr component
from the north, and a 14 km/hr from the east (where north is the
imaginary axis, and east the real axis). In electrical notation, say 4
volts, phase +45deg, or even better, 5 db gain and phase=+45 deg.
Phasors expressed with db make the math nice to work with.

Sometimes there is an additional amplifier stage between the input
and the summing point. It will not be affected by the feedback. Make
sure that this amp section is free of "warts". You'd hate to have set
up the main amp to be very good, and then have crud injected by the
additional stage.

The feedback network could be a simple voltage divider where
B=R1/(R1+R2), or something more complex with capacitors and other
components. It produces a voltage Vfb = B * Vout

The output(Vout) = A * Va (eq.1)
but Va = Vin - Vfb (eq.2)
Va = Vin - (B * Vout) (eq.3)
substitute for Va using eq3 and recalculate eq1:

Vout = A * (Vin - (B * Vout))
= A*Vin - B*A*Vout (eq.4)
gather Vin's and Vout's
Vout + B*A*Vout = A*Vin
factor Vout
Vout*(1 +B*A) = A*Vin
Since the effective gain of the whole system is G, and is Vout/Vin
moving things around you get:
Vout = Vin * ( A/(1+B*A)) (eq.5)
or: gain = G = Vout/Vin = A / (1 + B*A)

The original gain (A or open loop gain) is effectively reduced to a
lower "closed loop gain" (with feedback in place). It is reduced by
the factor "1 + B*A". If that's all feedback did, it wouldn't be much
use.

Suppose your amplifier circuit without feedback produced an
extraneous (unwanted) output, I'll call it "CRUD". Then:
CRUD
summing point .--------------. |
+ |Amplifier |Vao |+
input ---------------(X)------>|gain= A |->---(X)--.-- output
Vin - | Va | | + | Vout
| '--------------' |
| .--------------. |
| |feedback | |
feedback '------<-|network |<---------'
voltage |I/O ratio= B |
Vfb '--------------'
I have added the "CRUD" signal between the amp output and the real
output. You can add the CRUD signal anywhere INSIDE the feedback loop.
Vao = A*Va
Vout = A*Va + CRUD (eq.1a)
but Va = Vin - Vfb (eq.2a)
Va = Vin - (B * Vout) (eq.3a)
Vao = A * (Vin - (B * Vout))
Vao = A*Vin - B*A*Vout (eq.4a)
Vout = A*Vin - B*A*Vout + CRUD
gather terms,
Vout( 1+B*A) = A*Vin + CRUD
Vout = Vin * A/(1+B*A) + CRUD/(1+B*A) (eq.5a)

Compare eq.5 and eq.5a, you'll see that the value of "CRUD" has been
reduced by the factor (1 + B*A), just like the gain. So... if you
designed your amp to have an open loop gain 10 times what you need,
then reduce it with feedback to what you want, the noise, distortion
and unwanted behaviour is also reduced.
Similarly, the frequency response is extended, but with some
reservations. If you go to the frequency extremes, the open loop phase
response is such that the phase change can get to 180 degrees, and
that means your feedback becomes positive feedback, which makes
everything worse, or the system goes nuts and oscillates.


LOW TECH METHOD of OPTIMIZING FEEDBACK
...........................................
You need an oscilloscope, it should be able to respond to at least
10-50 times your intended high frequency limit. Similarly, it should
be able to respond to 1/10 to 1/50 of your low frequency limit (DC
response is preferred).
You need a signal generator that can give a quality square wave at
1000 Hz.
Put a resistor load on the amp, correct power rating and value.

Your feedback circuit (whose transfer function or "gain" is "beta"
or B) will look something like this:

to summing point
Vfb ------,---/\/\/\/\/--------- to output
| R1
\
/
\ R2
/
\
|
gnd

In this case B = R2/(R1 + R2) voltage divider
Since the effective gain is A/(1 + B*A) A= amp openloop gain,
if A is large compared to 1, you can approximate the equation to:
effective gain = 1/B = (R1 + R2)/R2; the error is 100%/A

Usually I keep R2 at a fixed value, and change R1. R2 is often a
cathode resistor for tube amps, and is awkward to change since biasing
is affected. In op-amps R2 is often to be matched to values on the
non-inverting side. So R1 is the one usually changed. For gains of 10-
50 (typical), R1 will be 10-50 times the value of R2.

Here's the problem - as you increase the feedback, the term (1 +
BA) increases. This is the factor by which the bad stuff goes away.
BUT, as that factor increases, the amp is more likely to go nuts at
some very high or very low frequency.
My first defense against nutty behaviour is to place a capacitor
in parallel with R1, and pick the cutoff frequency (where
|Xc|=1/(2*pi*f*c)=R) to a reasonable value. This is a tough choice.
You have a nice circuit, possibly with a very good output transformer,
that claims to go way beyond your usual limit (20KHz for audio). Let's
say your openloop amp (with transformer?) can have a cutoff of 150KHz.
I claim you should set the feedback cutoff to approximately 25-40 KHz.
One way or another, if your goal is to reduce distortion without crazy
amp behaviour, you'll be dropping your cutoff back to this value.

Here's how I go about it. Put a 1 KHZ square wave in the input,
watch the output on the 'scope. Choose a reasonable signal level,that
gives 2-5%of full output. Start off with no capacitor in parallel with
R1, and R1 about 50-100 times that value of R2. R1 is easiest to be a
trimmer resistor or potentiometer (pot). Decrease R1, watch out for
overshoot.Add a capacitor in parallel with R1, calculated to give the
desired cutoff. The over shoot should disappear. Decrease R1 further,
until overshoot shows up. You will need to increase the capacitor to
the proper cutoff. You will reach a point where R1 is as low as it can
go without lowering the cutoff freq. to silly values. Drop R1 to the
point where there is quite a bit of overshoot.
Now it's necessary to modify the phase response of the amplifier.
In order to do that, we must compromise its open loop response. I will
place a capacitor (optional variable resistor in series with it -
stepping network) from the first gain stage output (collector or
triode plate) to ground. This is called a "lag network". In the case
of transistor amps, you can put a cap from collector to base on an
intermediate stage. Select capacitors that make the overshoot go away,
without excessive rounding off the square wave edges. You can play
with the optional series resistor as well. This is a "dominant pole",
and reduction of gain at high frequencies. To really understand what's
happening here, you need to have a Bode plot (phase, and gain).
Pretty soon, you should have optimal feedback for the amp.
Now you need to tweak the system for stability. Remove the amp's
main load resistor, and use a .1uF - 4.7uF low ESR (Equivalent Series
Resistance) capacitor as load. Keep the leads short. The overshoot
should get real bad, and maybe the system will oscillate. Avoid that!
Things can overheat real quick.
Fiddle with the lag network (or stepping network) until it stops
oscillating, or reduce the ringing. It's not necessary to eliminate
the ringing, 'cause you don't normally have a very capacitive load
(unless you have electrostatic speakers).
Increase R1, play with the values of capacitor in parallel with R1,
change the capacitor and optional series resistor that were in the
first stage output. You don't need to eliminate the overshoot under
these conditions, just keep the system well away from oscillating.
Try to figure out what frequency the system likes to oscillate at.
Sometimes you can bypass cathode resistors or emitter resistors that
are "degenerative", with capacitors such that cutoff (Fc=1/(2*pi*R*C))
is at the oscillating frequency. This may shift the phase of the amp
towards something more stable.
It may help to put a snubber network across the output. Typically
its a resistor and capacitor in series. R is about 1-3 times the usual
load, and C is a value that gives a cutoff 2-3 times the max. useful
frequency (60-70 KHz). I used 10 ohms in series with 0.22uF. It helped
a bit. Watch out for the power rating of the resistor! If the amp
oscillates, the resistor may be cooked!
Usually you must back off the feedback to keep the system stable
with strange loads.
Once you think you have it set up (normal load), momentarily
overload the amp (set your signal generator to a much higher output)
and then quickly drop the signal to normal. Watch the amp's output for
low frequency junk (monitoring the DC current of the output devices is
a sensitive check). Things should immediately settle down, without low
or high frequency jiggle. If they don't... you have a problem with low
frequency phase shift. You should have one stage with poor low
frequency response (often a transformer), the rest should have better
low frequency responses. This establishes a "dominant zero", which
with feedback should give better stability.

At the end of this exercise, you have an amp whose frequency
response is about 25-40 KHz, with a maximum amount of feedback,
without going nuts with a capacitive load. Maximizing feedback,
without losing too much stability is the goal. Determine the ratio of
openloop (no feedback) gain to closed loop (max feedback) gain. This
will be the factor 1 + BA, and all the bad things you amp can do will
be reduced by this factor. You weren't able to extend your frequency
response, but the compromise allowed you to further reduce distortion,
noise, hum and other extraneous signals generated by the amp.

DETAILED, THEORETICAL METHOD
..................................

Now you need to make a whole lot of measurements on your system.
Most importantly, you need to measure the open loop (no feedback)
response of your amplifier. You need the amplitude of the output, and
the phase of the output as compared to the input. These will establish
gain and phase response of the system.
The frequency range (sine wave) must extend beyond where the gain
drops to 1.0 . Include the frequencies where the gain is 0.5 or lower,
and you should be fine. Some of these frequencies are difficult to
measure, it's probably easiest to use an oscilloscope (one that
responds down to DC). A 'scope isn't all that accurate, however!
I prefer using a 'scope and I'll measure the input and output
voltages using peak-to-peak, simply because it's easier on a 'scope.
Be careful if you switch between RMS and p-p to adjust the values. At
very high frequencies, when the output is very low, you may have
trouble measuring in the presence of hum from the amp output. Switch
your 'scope triggering to "line", and measure the thickness of the
trace. The hum should be stationary on the display.

Phase measurements can be tricky. You need a 2 channel 'scope, it
must have DC response (otherwise phase will be affected at low
frequencies). Your triggering should be external, and the 'scope
triggering input should come from the "sync" or equivalent (square
wave output) from the signal generator. Your scope should also allow
you to view each channel separately, in addition to both at the same
time ("chop" or "alternate"). You need to see the reference channel by
itself every once in a while, to establish which way to time the
signals.
Here's the way I do it:
Ch. A: reference (input)
Ch. B: output
- Ch. A and B both set to DC, both zero'd so the baselines overlap.
- amplitudes set on both channels to fill at least half the screen.
- timebase set to show 1 period (approx)
- start at mid band frequency (500 Hz).
- waveforms should cross baseline at about the same time, and
should be similiar in shape. If one is opposite (one goes up when the
other goes down), switch the invert button on one of the 'scope
vertical channels.
- As the phase changes, similiar events (+ going signal crossing
the baseline) for the two waveforms will shift. You need to measure
and record the event's TIME shift (measured compared to reference).

ref
.'.
/ \__
/ .' '.measured
/ / \ \ /
/ / \ \ / /
--/---/-------\---\-------*---/--------------
/ / \ \ / /
/ / \ \ / /
\ '. .'
| | \ /--
| | '.'
| |
t0 t1
In the above ASCII drawing (yuchh!) I have shown the reference and
measured signals. The +going measured signal crosses the axis at t1,
the reference at t0. Record the value (t1 - t0) which will be a
positive value in time corresponding to a negative phase angle. It's
negative because at t0 the reference is at zero degrees. At that same
time (t0) the measured angle is at some negative phase angle.
Reference=sin(wt), measured=sin(wt+theta). If we assume t=0, then
theta must be negative. It's confusing, especially when you look at
the
orientation of the two waveforms. Be very careful measuring phase when
it gets close to 180 deg or more. It's EASY to lose track of which one
is reference. With a 'scope (externally triggered), you should be able
to select one channel at a time to make sure you know which is
reference.
To calculate the phase angle (degrees),
phase=-360*(t1-t0)*frequency.
Above the midband you should see + time (- phase), and below midband
you should see - time (+ phase).
First we need the open loop response of the amplifier system being
tested.
Here is data taken from a tube amplifier that I'm playing with:

Table 1.1
Open loop response
Vin(Volts-pp)= 0.0148


delta-t V out gain gain phase
Freq us v-pp db degrees

1.5 -225000 0.02 1.4 2.6 121.5
2 -200000 0.038 2.6 8.2 144.0
2.5 -165000 0.076 5.1 14.2 148.5
3.5 -130000 0.17 11.5 21.2 163.8
5 -100000 0.36 24.3 27.7 180.0
7.5 -54000 0.8 54.1 34.7 145.8
10 -35000 1.2 81.1 38.2 126.0
20 -12000 2.4 162.2 44.2 86.4
35 -4800 3.5 236.5 47.5 60.5
50 -2600 4 270.3 48.6 46.8
100 -700 5 337.8 50.6 25.2
200 -160 5.4 364.9 51.2 11.5
350 0 5.4 364.9 51.2 0.0
500 40 5.4 364.9 51.2 -7.2
1000 60 5 337.8 50.6 -21.6
3000 50 3.4 229.7 47.2 -54.0
4000 44 2.9 195.9 45.8 -63.4
5000 40 2.4 162.2 44.2 -72.0
7500 32 1.65 111.5 40.9 -86.4
10000 27 1.28 86.5 38.7 -97.2
15000 20 0.8 54.1 34.7 -108.0
20000 16 0.6 40.5 32.2 -115.2
30000 12.5 0.36 24.3 27.7 -135.0
40000 11 0.25 16.9 24.6 -158.4
50000 9.2 0.17 11.5 21.2 -165.6
75000 8 0.08 5.4 14.7 -216.0
100000 7 0.032 2.2 6.7 -252.0
150000 5 0.013 0.9 -1.1 -270.0
200000 3 0.0044 0.3 -10.5 -216.0
250000 2.6 0.0036 0.2 -12.3 -234.0
300000 2.2 0.0024 0.2 -15.8 -237.6

"delta-t" is the time between reference and measured events (t0-t1),
in microseconds. The phase shift is quite excessive! It has been
compensated (a dominant pole has been placed in the plate load of the
first stage). Without the compensation, the phase shift is not as bad.
However, without the compensation, I cannot apply very much feedback
before the system gets unstable. This open loop circuit also has
positive feedback inside it (between 1st and 2nd stage). this has
slight effect at high frequencies, but has considerable effect at the
very low frequencies due to capacitive coupling within the positive
feedback loop.
The following chart shows the slope of the above open loop gain vs.
frequency, to show possible areas of trouble. You can see that the
slope is bad at 75KHz, where the slope is 19 db/octave. In fact, with
capacitive loads (which aggravate the stability), that's the frequency
where the system wants to oscillate. It get worse at higher
frequencies, but at that point, the gain is very low.
The attenuation in db/octave is:
db/octave= (db@f1-db@f2) * log-base-2-of(f2/f1)


Table 1.2
Open loop gain-phase data
gain phase
Freq db degrees octaves db/octave

1.5 2.62 121.50 0.42 -13.43
2 8.19 144.00 0.32 -18.70
2.5 14.21 148.50 0.49 -14.41
3.5 21.20 163.80 0.51 -12.67
5 27.72 180.00 0.58 -11.86
7.5 34.66 145.80 0.42 -8.49
10 38.18 126.00 1.00 -6.02
20 44.20 86.40 0.81 -4.06
35 47.48 60.48 0.51 -2.25
50 48.64 46.80 1.00 -1.94
100 50.57 25.20 1.00 -0.67
200 51.24 11.52 0.81 0.00
350 51.24 0.00 0.51 0.00
500 51.24 -7.20 1.00 0.67
1000 50.57 -21.60 1.58 2.11
3000 47.22 -54.00 0.42 3.33
4000 45.84 -63.36 0.32 5.11
5000 44.20 -72.00 0.58 5.56
7500 40.94 -86.40 0.42 5.31
10000 38.74 -97.20 0.58 6.98
15000 34.66 -108.00 0.42 6.02
20000 32.16 -115.20 0.58 7.59
30000 27.72 -135.00 0.42 7.63
40000 24.55 -158.40 0.32 10.41
50000 21.20 -165.60 0.58 11.19
75000 14.66 -216.00 0.42 19.18
100000 6.70 -252.00 0.58 13.38
150000 -1.13 -270.00 0.42 22.67
200000 -10.54 -216.00 0.32 5.41
250000 -12.28 -234.00 0.26 13.39
300000 -15.80 -237.60

In much of the design literature, you are supposed break the above
data into segments, where each segment is a multiple of 6db/octave,
corresponding to a pole or zero. From the above real data, this is not
going to be a simple task. The only clear sloped area is from 4KHz to
15KHz, and that's from my lag network.

To get a measure of how prone the system is to oscillation,
you can make a "Nyquist diagram". That is the measure of B*A in
magnitude and phase, plotted on a polar scale (or on rectangular
complex scale).
You can also (more easily) make a "Bode diagram". This is a
measure of B*A and phase, each one plotted vs. frequency, on a
conventional X-Y graph.
It is possible to compute "BA" from open and closed
loop responses, but the results are very rough at low signal levels
due to measurement problems. Trying to use that data in calculations
generates a lot of error. It's not worth the effort to do it that way,
unless you have some automated systems.
You can get "B*A" by the following method:
Disconnect the feedback network from the amplifier output. The
system will be running open loop now. Insert your test signal into the
feedback wire you just disconnected! Now your test signal goes through
the feedback network (B or beta), and THEN through the open loop
amplifier ("A"). The gain will be B * A ! Measure the response (gain
and phase shift). When you do this, the output will be inverted
because of the polarity at the summing point. You can flip the
polarity with most scope input controls.
Here are the results from doing this measurement with the amp
above:

Table 1.3
"BA, or loopgain, or T, or return ratio)"
for Bode diagram for Nyquist diagram
gain gain phase BA-real BA-imaginary
Freq db
1.5 0.350 -9.1 162.0 -0.33 0.11
2 0.625 -4.1 154.8 -0.57 0.27
2.5 0.925 -0.7 144.0 -0.75 0.54
3.5 1.500 3.5 126.0 -0.88 1.21
5 2.400 7.6 108.0 -0.74 2.28
7.5 3.750 11.5 90.5 -0.03 3.75
10 4.500 13.1 72.0 1.39 4.28
20 7.500 17.5 54.7 4.33 6.12
35 10.000 20.0 36.5 8.03 5.95
50 11.000 20.8 28.8 9.64 5.30
100 12.500 21.9 12.6 12.20 2.73
200 12.500 21.9 2.9 12.48 0.63
350 12.500 21.9 -5.0 12.45 -1.10
500 12.500 21.9 -7.2 12.40 -1.57
1000 11.000 20.8 -25.2 9.95 -4.68
3000 6.750 16.6 -48.6 4.46 -5.06
4000 5.500 14.8 -54.7 3.18 -4.49
5000 4.750 13.5 -57.6 2.55 -4.01
7500 3.500 10.9 -64.8 1.49 -3.17
10000 3.000 9.5 -68.4 1.10 -2.79
15000 2.100 6.4 -75.6 0.52 -2.03
20000 1.650 4.3 -82.8 0.21 -1.64
30000 1.200 1.6 -90.7 -0.02 -1.20
40000 0.900 -0.9 -97.9 -0.12 -0.89
50000 0.700 -3.1 -102.6 -0.15 -0.68
75000 0.450 -6.9 -121.5 -0.24 -0.38
100000 0.250 -12.0 -133.2 -0.17 -0.18
150000 0.150 -16.5 -124.2 -0.08 -0.12
200000 0.083 -21.7 -129.6 -0.05 -0.06
250000 0.075 -22.5 -144.0 -0.06 -0.04
300000 0.070 -23.1 -151.2 -0.06 -0.03

By plotting B*A in db vs. frequency, and phase vs. frequency you
get a "Bode diagram".
The stability can be determined directly from this data.
Determine how far away you are in degrees from +- 180 deg at gain=1 or
0db gain. In my case, unity gain (0db) has a margin of 180-94 (86)
degrees at around 35KHz. At low frequencies, unity gain has a margin
of 180-140 (40) degrees at around 2Hz.

You can plot (B*A) and phase as a polar plot. This is a
"Nyquist diagram". The B*A vector is pinned at one end to the
origin, it swings around according to the phase, and the other end
of the vector draws a line. Few people have that kind of paper, so you
can convert it to complex and plot it on a rectangular scale using
complex numbers.
You can use simply the classic methods to convert phasors to
complex numbers and back:

phasor pair : magnitude, phase
complex pair : real, imaginary

real=magnitude*cos(phase)
imaginary=magnitude*sin(phase)
or
magnitude=sqrt(real^2 + imaginary^2)
phase=ATAN(imaginary/real)

The last two columns in Table 1.3 are the rectangular complex
values used to draw the Nyquist diagram on an XY scale. The following
is a crude representation of the B*A data for my amp, graphed directly
from the B*A phasor data converted to complex:

Nyquist diagram for table 1.3

y axis (imaginary)
| a=10Hz
| b=100 Hz
|.--''--.._ c=1 KHz
/ a \b d=10KHz
{ \
_______\ |_________x axis (real)
/ |
{ / polar plot of gain(B*A)vs phase
\ / or complex plot of the BA vector
|'-..__..-'c
| d
|
This plot shows direction how the B*A magnitude is pointing
(rotating about 0,0). In this case, B*A is pointing at 0 degrees
around
300Hz, 90 deg just below 10Hz, and -90 deg. at 30KHz.
The shape you get is like a heart with a rounded bottom, but
rotated counterclockwise so the rounded bottom is now pointing to the
right. The dimple at what used to be the top of the heart is now on
the left, and the dimple is at the origin (0,0) of the plot. This
origin corresponds to the zero gain at very low and very high
frequencies. A DC amplifier wouldn't have the top half (DC gain
constant at all low freq.
Stability and tendency to oscillate depend on the behaviour of
the lobes that are on the left, above and below the x axis, and have
negative x values.
If the Nyquist diagram touches or encloses where x=-1, y=0, the
system may oscillate. How close it gets to that point determines the
degree of instability and overshoot. Some Nyquist diagrams have
multiple loops in this area - determining stability in those cases is
a bit more complex. You really need to dig up a textbook in that case.
The tangent of the curves (or angles of the lines) in this area also
determine stability. The tangents that are close to x=-1,y=0 determine
phase margins. The trick is to keep the lines from sloping to +180 or
- 180 where gain=1. Often you'll see a circle drawn with a radius=1
(that's gain=1). Where your graph cuts that circle, the angle between
the phase at that intersection and the -X axis is the system "phase
margin". It's probably easier to use the Bode plots to establish this
value. It turns out that you can do a better job using Nyquist
diagrams and plotting all the poles and zeros, than analyzing using
Bode plots. The increased complexity, math, and weird mapping puts
that method out of reach for most hobbyists and "weekend designers".

LAG COMPENSATION:

Let's say your system with feedback is on the verge of
oscillating. You can compensate the system by prematurely rolling off
the frequency response, and altering the system phase response. This
is done as described in the "LOW TECH METHOD" section above, by
putting a capacitor to ground in the collector/plate circuit, or
adding a local feedback loop with a capacitor between a stage input
and output.

.--------------. C2
| Gain stage | | |
| current |-----.----| |-------.
| output | | | | |
'--------------' | |
LAG compensation \ \
network. "stepping / R2 / R3 (optional)
network" if R3 is \ \ zero ohms
not zero / / normally
| |
| |
gnd gnd


R3 is replaced by a short, normally. If you use R3 it's called a
"stepping network". Without R3, the -3db point (where the phase angle
would be -45 deg) is fc=1/(2*pi*R2*C2). At an octave above fc, the
phase angle would be about -65 deg.
With R3 in the circuit, you need to calculate the phase/amplitude
response for the different values of R2,R3,C2.
In the example I used here, I built the amp with the simple lag
network. I tried the "stepping network", but it wouldn't cut the gain
enough to get the desired phase margin.

Here's the before and after response for a lag compensation:

Table 1.4
open loop response
uncompensated compensated difference
Freq Phase Gain Phase Gain gain phase
1.5 135.0 0.0 135.0 0.0 0.0 0.0
2.5 148.5 13.6 148.5 13.6 0.0 0.0
3.5 170.1 21.0 170.1 21.0 0.0 0.0
5 194.4 28.0 194.4 28.0 0.0 0.0
7.5 118.8 34.0 118.8 34.0 0.0 0.0
10 108.0 36.9 108.0 36.9 0.0 0.0
20 57.6 41.2 57.6 41.2 0.0 0.0
35 37.8 42.6 37.8 42.6 0.0 0.0
50 27.0 42.9 27.0 42.9 0.0 0.0
100 14.4 43.5 14.4 43.5 0.0 0.0
200 7.2 43.8 7.2 43.8 0.0 0.0
350 2.5 44.1 0.0 44.1 0.0 -2.5
500 0.0 44.1 -2.2 44.1 0.0 -2.2
1000 -3.6 44.1 -10.8 44.1 0.0 -7.2
3000 -13.0 44.1 -32.4 43.2 -0.9 -19.4
4000 -17.3 43.8 -41.8 42.3 -1.5 -24.5
5000 -21.6 43.5 -48.6 41.6 -1.9 -27.0
7500 -32.4 42.9 -64.8 39.1 -3.8 -32.4
10000 -43.2 42.6 -79.2 37.5 -5.1 -36.0
15000 -59.4 41.2 -94.5 34.6 -6.6 -35.1
20000 -72.0 39.6 -108.0 32.0 -7.5 -36.0
30000 -97.2 36.9 -129.6 27.6 -9.3 -32.4
40000 -115.2 34.2 -146.9 24.6 -9.5 -31.7
50000 -129.6 32.0 -162.0 21.2 -10.8 -32.4
75000 -172.8 26.0 -194.4 14.0 -12.0 -21.6
100000 -187.2 18.8 -216.0 6.8 -12.0 -28.8
150000 -194.4 13.1 -216.0 -2.5 -15.6 -21.6
200000 -201.6 5.1 -216.0 -12.0 -17.1 -14.4
250000 -216.0 1.9 -234.0 -15.1 -17.1 -18.0
300000 -237.6 0.0 -259.2 -18.4 -18.4 -21.6

Looking at the uncompensated system, the upper -3db point is around
15KHz. The compensated system's upper -3db point is near 5KHz. At
first glance this seems quite unproductive!
Let's assume you have about 20db of feedback. That means subtract
20 db from the openloop gains. What I have done is simulate a feedback
network that is a 10:1 voltage divider, or B (beta) equals 0.1 (-
20db). When the result = 0db, check the phase angle..... If it's close
to, or greater than +- 180 deg., the system is unstable. In the
uncompensated amp, the result is close to 0db at 75-100 KHz, and the
phase is near +-180 deg. This system will oscillate.
Doing the same calculation for the compensated amp, the resultant
gain (subtract 20 db) is 0 db at 40 KHz, but you are 30-40 degrees
away from oscillating (phase margin about 35 deg). Not really great,
but much better than having the amp go nuts!
The primary reason for using lag compensation is to reduce the
loopgain (B * A) at high frequencies, thereby giving a better phase
margin (keeps you away from the -180 deg. at B*A=1 or 0db).
The "stepping network" is a less extreme version of the lag
network, and is used where the phase response is important beyond
where the gain has been cut. It drops the phase lag back to zero at
frequencies much higher. In many amps, once you get above the point
where B*A is 1 (or 0db), it's well out of the frequencies of interest,
and phase response isn't much of an issue (you've already set the
phase margin for where B*A=1). From my limited experience, the
stepping network works well where you have large margin of stability,
but when you are squeezing a system hard, the plain lag network works
better.


AMOUNT of FEEDBACK VS. STABILITY (BODE Method)

Here's a table of the same open loop response, but limited to the
extreme frequencies, and showing the effect of -10db, -20db, -30db
feedback. All I did was add the db's corresponding to the beta's
of -10db, -20db, -30db. -10db corresponds to beta=.31, 20db beta=0.1,
30db beta=0.03.
The 10db corresponds to a LOT of feedback.

Table 1.4A
(B*A), or loopgain
beta (voltage divider in feedback)
none (huge db) -20db -10db -30db

compensated compensated compensated compensated
Freq Phase Gain Phase Gain Phase Gain Phase Gain

500 -2.2 44.1 -2.2 24.1 -2.2 34.1 -2.2 14.1
...................................................................
20000 -108.0 32.0 -108.0 12.0 -108.0 22.0 -108.0 2.0
30000 -129.6 27.6 -129.6 7.6 -129.6 17.6 -129.6 -2.4
40000 -146.9 24.6 -146.9 4.6 -146.9 14.6 -146.9 -5.4
50000 -162.0 21.2 -162.0 1.2 -162.0 11.2 -162.0 -8.8
75000 -194.4 14.0 -194.4 -2.0 -194.4 4.0 -194.4 -16.0
100000 -216.0 6.8 -216.0 -15.2 -216.0 -3.2 -216.0 -23.2
150000 -216.0 -2.5 -216.0 -22.5 -216.0 -12.5 -216.0 -32.5
200000 -216.0 -12.0 -216.0 -32.0 -216.0 -22.0 -216.0 -42.0
250000 -234.0 -15.1 -234.0 -35.1 -234.0 -25.1 -234.0 -45.1
300000 -259.2 -18.4 -259.2 -38.4 -259.2 -28.4 -259.2 -48.4

By inspecting the above data, you can see that the -10db feedback
will most likely oscillate since the phase angle exceeds 180 deg.
where B*A is 0db (or 1). The system with -30db feedback won't
oscillate and has a phase margin of about 70 degrees. You can see that
in this case, the -20db feedback is as close as we can get before the
system is unstable.
You can apply more aggressive compensation (in the lag network).
This will allow you to put more feedback, but there's a point where
you roll off B*A in the audio range. That means you aren't getting the
benefit of feedback any more. It will be good for low frequencies, but
have little effect at higher audio ranges. My guess is that you
shouldn't set the lag network to cut in much below 10KHz for audio
work.


You do get the frequency response back again (and better) with the
closed loop response. Here's the closed loop response for the same amp
whose open loop response appeared in table 1.1:

Table 1.5
closed loop gain

gain phase
Freq db degrees

1.5 10.0 226.8
2 17.9 172.8
2.5 19.5 135.0
3.5 20.9 100.8
5 22.0 82.8
7.5 23.4 67.5
10 25.1 68.0
20 26.5 30.2
35 27.3 20.2
50 27.5 12.6
100 27.7 7.2
200 27.7 2.9
350 27.7 0.0
500 27.7 0.0
1000 27.7 -3.6
3000 27.7 -8.6
4000 27.7 -11.5
5000 27.7 -14.4
7500 27.5 -21.6
10000 27.3 -28.8
15000 26.9 -43.2
20000 26.0 -57.6
30000 24.5 -86.4
40000 22.7 -103.7
50000 21.3 -122.4
75000 16.4 -183.6
100000 9.1 -201.6
150000 0.0 -216.0
200000 -8.0 -230.4
250000 -10.0 -234.0
300000 -13.5 -237.6

The -3db points are at 9 Hz and 30 KHz. The upper -3db point would
have been a lot higher, but I dropped it down to 30KHz to give a
better phase margin and improve stability. So far feedback sounds
pretty wonderful except for it's ability to cause instability. You can
fiddle with an amplifiers phase/gain response to maximize the amount
of feedback, but there is a limit if you want to keep the closed loop
response to reasonable values.
I set the -3db point by applying a compensation in the feedback
circuit. the feedback compensation does two useful things: it sets a
reasonable overall system bandwidth, and it shifts the phase change
the other way by using a "lead network".

LEAD NETWORK in FEEDBACK

Here's the feedback network with C1 added, which provides lead
compensation, and also sets the system bandwidth:
| | C1
.-----| |------.
| | | |
to summing point | |
Vfb ------,---/\/\/\/\/--'------- to output
| R1
\
/ My amp:
\ R2 R2=400 ohms (approx.)
/ R1=10 Kohms
\ C1=390 pF
|
gnd
The above values (R1, R2) set the closed loop gain to
approximately R1/R2, or about 25. It's not exact, it depends also on
the open loop gain (A).
R1 and C1 set the -3db point to be approximately 40KHz
(f=1/(2*pi*R1*C1).
The important aspect of this network is that it gives a "lead"
(positive) phase angle, opposite to the normal lagging phase angle you
normally get at the upper frequency limit. Because this circuit
defines "beta", it will affect B*A (the loopgain). It will shift the
phase THE OTHER WAY, and improve the phase response, and margin of
stability. In other words, it will make the system less prone to
oscillate. Here's the above circuit's amplitude and phase response:

TABLE 1.5A
Response of feedback network ("beta")
freq db phase
1.5 -26.96 0.00
2 -26.96 0.00
2.5 -26.96 0.00
3.5 -26.96 0.00
5 -26.96 0.01
7.5 -26.96 0.01
10 -26.96 0.01
20 -26.96 0.03
35 -26.96 0.05
50 -26.96 0.07
100 -26.96 0.13
200 -26.96 0.27
350 -26.96 0.47
500 -26.96 0.67
1000 -26.95 1.34
3000 -26.93 4.02
4000 -26.92 5.35
5000 -26.89 6.67
7500 -26.81 9.94
10000 -26.70 13.14
15000 -26.41 19.24
20000 -26.02 24.85
30000 -25.09 34.43
40000 -24.04 41.91
50000 -22.99 47.63
75000 -20.57 56.73
100000 -18.56 61.52
150000 -15.46 65.41
200000 -13.18 66.06
250000 -11.42 65.35
300000 -10.00 63.99

Multiplying the "beta" response by the open loop response "A" we
get the loopgain (B*A). Multiplication of phasors is product of
magnitudes, and sums of angles. Because I used db for magnitudes, I
add them. That's the nice feature of db's!
Here's the result (B*A) including the lead network in the
feedback (beta) circuit:

TABLE 1.5B
Freq B*A B*A
Hz db phase

350 24.3 0.5
500 24.3 -6.5
1000 23.6 -20.3
3000 20.3 -50.0
4000 18.9 -58.0
5000 17.3 -65.3
7500 14.1 -76.5
10000 12.0 -84.1
15000 8.2 -88.8
20000 6.1 -90.4
30000 2.6 -100.6
40000 0.5 -116.5
50000 -1.8 -118.0
75000 -5.9 -159.3
100000 -11.9 -190.5
150000 -16.6 -204.6
200000 -23.7 -149.9
250000 -23.7 -168.6
300000 -25.8 -173.6

Now after using the lead network in the "beta" circuit, when you
check B*A for stability, ie., how close to +-180 degrees at BA=1 (or
0db), you can see we have 80 or 90 degrees phase margin. That's
probably enough to tolerate a purely capacitive load.

FEEDBACK ISSUES

Feedback DOES have a related dark side. We expect feedback to
reduce the overall gain. It does this in most of the bandwidth, but at
the upper and lower (if your amp is not DC coupled) extremes, it
INCREASES the overall gain. This happens when you look at the Nyquist
diagram, and your response curves get inside the little unity gain
circle. This is very common! Seeing as Nyquist diagrams are a pain to
produce, check the phase/gain data for the amplifier described above
at the frequency extremes, and compare the closed loop (feedback) and
open loop (no feedback) responses. The feedback amp has about about
8db more gain at low frequencies, and 2 db more gain than the open
loop system!

Table 1.6
Amplifier Gain (not B*A) and phase - no feedback vs. feedback
open loop closed loop
gain phase gain phase
Freq db degrees db degrees

1.5 2.62 121.50 10.0 226.8
2 8.19 144.00 17.9 172.8
2.5 14.21 148.50 19.5 135.0
3.5 21.20 163.80 20.9 100.8
5 27.72 180.00 22.0 82.8
.......................................
150000 -1.1 -270.0 0.0 -216.0
200000 -10.5 -216.0 -8.0 -230.4
250000 -12.3 -234.0 -10.0 -234.0
300000 -15.8 -237.6 -13.5 -237.6

This means (for audio work) that the system is giving excessive
amplification for "rumble" or radio frequencies. If you didn't pay
attention to this behaviour and filter out those frequencies on the
input (prior to the feedback loop), you could get some nasty
behaviour. This is also a mechanism whereby RF (radio frequencies) can
get into your system from the output (speaker) wiring. In some
situations you might need to filter BOTH the inputs and outputs at
high frequencies!
Normally the system gain at these extremes is pretty low, and
should be quite a bit lower than midband gain. You should be aware of
this problem if you are exposed to unusual signal conditions such as
turntable rumble, radio frequency interference, EMI, crosstalk,
clock frequency noise (CD player, or digital circuits), etc. AND your
feedback forces a high gain at the extremities.

As I mentioned above, there IS a limit to how much feedback you
can apply. My guess is that it is difficult to have B*A much in excess
of 20-25db for a tube amplifier. Semiconductor amps can allow
considerable more, especially with high bandwidth FET's/transistors. I
have heard of designs with 250db of feedback! Those would be low
frequency extremely high accuracy systems.

Feedback systems can be very naughty when the system is nonlinear,
and especially if the system has low phase margins. Poorly designed
class B amplifiers with too much bias current or badly designed
current "crossover" on output devices can change "A" on the fly, and
cause problems. Near saturation, some circuits will cause the system
to momentarily oscillate as phase/gain characteristics change. I have
had some otherwise well designed amplifiers show this kind of trouble.
The maximum gain under dynamic conditions would need to be calculated
or measured, and the stability margin would be calculated or measured
based on the worst-case value for the changing open-loop gain ("A").

Feedback systems want instant feedback..... delays really mess up
stability. Normally you don't think of delays other than phase shifts,
but some circuits will have "slew rate limiting". That's where the
system can only change the voltage at a fixed rate (slewing), no
matter how hard it's driven. During this time, the circuits on either
side of the "slew rate limiter" are out of touch with each other, and
must wait until things settle down. This behaviour can haunt badly
designed semiconductor amplifiers. The delay time can be converted to
phase at the frequency where stability margin is calculated, and
considered as an additional lag. It will reduce the stability margin.

The last 2 problems should prompt the designer to back way off on
the amount of feedback!


-Paul


.