basic question about integrators in a loop (circle test)

Jul 19, 2025 Last reply: 11 months ago 43 Replies

No worries—I’ve had to repent for my bad temper in these hallowed halls on occasion. ;)

Yup. Five iterations of Newton-Raphson will make an oscillator amplitude-stable in LTspice to machine accuracy.

Cheers

Phil Hobbs

I'm not quite following this. I'm not currently tuning things that finely in my analog computer, but I could. I think the normal approach with analog computers in the past was (1) component tolerance of 1% or better; and (2) insert a gain adjustment knob right before the capacitor(s) so you can speed or slow down the integration to a precise time unit, using a counter. Or, alternatively, you could use a comparator and test two integrators at a time just to make sure they are all at the same time unit.

I used high precision resistors — I think they were 0.25%. I'm not sure though what the tolerance is on these polyester capacitors that I had handy. A batch I got off Amazon a few years back. 10nF is 2A103J.

I'm still early on in my study of differential equations, and Laplace transforms aren't covered until one of the late chapters of the textbook I am using. I don't think I studied root-locus analysis yet.

J tolerance is +-5%. K is +-10%, M is +-20%. Lots worse than the resistors.

Single-sided Laplace really applies only to initial-value problems. Those are nice for teaching purposes but have only a very oblique connection to the real world, where there is all sorts of external forcing after power-up, due to supply voltage, load variations, temperature, circuit noise, yada yada.

Loop stability can be broken up into small-signal stability, where the gain doesn't vary with signal level, and large-signal stability, where it does. Small-signal stability is easiest to understand in the frequency domain, using frequency compensation ideas. (The difference between the two is responsible for oscillator startup problems, which is also an interesting topic, but at the moment we're trying not to build an oscillator.)

As indicated, small-signal stability lives in the Fourier domain, or the two-sided Laplace domain, which is exactly the same except with the plot rotated 90 degrees. The one-sided Laplace is derivable from them. (The Z transform is also trivially related to them, which makes discrete-time processes more intelligible to circuits folk, but I digress.)

A feedback system's stability is governed by its _phase margin_, which is the difference between the closed-loop phase shift and 360 degrees, evaluated at the frequency where the loop gain drops to 1.0.

(Deep breaths) Some context might possibly be helpful. ;)

An amplitude-stable electronic oscillator is a feedback loop whose round-trip gain is 1.0, with zero phase, at some frequency f_0. That is, first you break the feedback loop at some convenient point, making one side the input and the other side the output. (If it isn't obvious which side is which, split the loop somewhere else.)

Then, if you drive the input side with

V_in = A sin (2 pi f_0 t),

the output will produce exactly the same waveform. One has to correct for source and load impedance, as well as possible nonlinearity, but this is the gist--stability is basically a linear problem.

The complex-valued ratio of the output signal to the input is called the _loop_gain_. (If you're not comfortable with complex notation for circuits, we can talk about that too.)

In order for the oscillation to be stable, the magnitude of the loop gain |A_VL| has to be exactly unity. Loosely speaking, if the initial signal is 1, the first pass round the loop will make it A_VL, the second pass A_VL**2, and so on. So if |A_VL| isn't 1.0000..., you don't get amplitude stability.

In the same vein, the phase of the loop gain has to be an integer multiple of 2 pi, or else the phase will keep walking, i.e. f_0 isn't what we thought it was.

Feedback loops also need to be stable at DC. You can't phase-shift DC, so you have two choices: inverting (phi = 180 degrees) or noninverting (phi = 0). For a stable loop, we have to pick the inverting case, so at DC,

arg{A_VL} = 180 degrees.

Thus we usually think about the _loop phase_ as ranging from 0 to -180 degrees, i.e. the range of additional delays between an inverting DC amp and an oscillator. (The electrical engineering sign convention is that a delay has a negative phase.)

If |A_VL| < 1 when the loop phase reaches -180 degrees, the oscillation condition is not met, and the loop is stable. (Though not necessarily well-behaved--see below.) The ratio 1/|A_VL| at 180 degrees is called the _gain margin_ of the loop, and is a measure of its stability.

Equivalently, if the loop phase arg(A_VL) hasn't reached -180 degrees at the frequency f_0 where |A_VL| = 1.0, the loop is stable. The _phase_margin_

phi_M = 180 degrees + arg(A_VL) @ f_0

is also a measure of loop stability. (Remember, arg(A_VL) < 0.)

Of the two, phase margin is more useful in design work.

A nice critically-damped second-order system has a phase margin of about

65 degrees, iirc. At higher values the system is overdamped, and at lower values it's underdamped, so that the impulse response exhibits overshoot and rings. The ringing gets worse quite rapidly as phi_M declines, and for most purposes 45 degrees is effectively the limit. This is more or less true even for higher-order loops--65 degrees gets you a nice monotonic step response, anything less will ring at least a bit. As phi_M goes to 0, the ringing gets worse and worse, and when phi_M reaches zero, it becomes a continuous oscillation.

Cheers

Phil Hobbs

Two serious limits are the finite gain-bandwidth of the opamps and losses in capacitors.

I'd Spice it to get a feel for things. I like to use Universal Opamp2 so I can fiddle the gain-bandwidth. And one can add series and parallel resistance to the caps.

If you use Spice without putting in the data sheet equivalents series and parallel resistances and inductances for you capacitors you aren't using it to simulate the real circuit you are trying to simulate.

Most resistor have a about 0.05pF of parallel capacitance which rarely matter (but if you are using 1M resistors at high frequencies, it does).

Inductors almost always have significant parallel capacitance and series resistance, and mostly both matter.

An ox is male. A cow is female. It may be fashionable to ignore gender differences, but it is imprecise.

Oxen are a type of bovine, bull and cow are the sexes.

Oxen are usually castrated males. They are always trained daft animals, and the name is reserved for mature animals over four years of age. Again, you are being imprecise. This undercuts any comic effect you might have been aiming for.

Thanks for the response Phil, seems like the most helpful one so far.

Sorry, I got lost on the discussion of Laplace and Z-transform and such like. Hopefully I'll catch up with you in another few months of study.

I'm familiar with the basic idea of complex numbers and relation to circuits (i.e., inductance/capacitance as imaginary) but I'm not practiced in circuit analysis and more hand-holding would be appreciated. I explored complex numbers a little once a few years ago in some studies in SDR DSP, in a ham radio context.

...snip...

Help me as I try to process this: so, a particular amp op model has a certain phase margin for a given frequency, which is the "safety margin" (wikipedia) where the output won't at least grow in amplitude. Now assume that I'm just using op amps as integrators with feedback capacitors and input resistors, and that the outputs are just connected to other integrators of like design (not some really weird load): can I calculate my phase just by looking at the input resistor, feedback capacitor, and a target frequency?

In my application, aiming for accurate modeling of, say, a spring damper system, I would think the goal would be to stay as close as possible to the phase where I would have unity gain. So maybe I would need to speed or slow down the simulation with a coefficient variable resistor, to stay near an ideal frequency?

I had trouble following the part where you explained how we stay stable at DC, though I'm not doubting it was a good explanation. I'll try to study/review this some more.

I good way to build physical instinct is to play with a microphone on a HiFi system in a room. As you turn the volume up, you will get to a point where the room seems to ring a bit - this where your phase margin is marginal. If you turn the volume up even more, it will howl or screech. The loop gain at some frequency now exceeds unity.

Joe

<snip>

Op amps intended to be stabilised by negative feedback have have a particular variation of phase angle and gain with frequency (Bode plot) where the phase shift doesn't reach 180 degrees below a frequency lower than the one where the gain has dropped to less than one.

Easy to use op amps have a nice smooth linear rise in phase shift with frequency with an equally smooth decline in gain. Crankier op amps can still be useful.

You need to be aware of the Bode plot of the op amp you are planning to use, as well as the input resistor, the feedback capacitor and your target frequency. If the op amp hasn't got enough bandwidth, the circuit won't work.

You'd need to sped up or slow down the simulated circuit. The simulation is just modelling the circuit you have chosen to simulate.

Lot's of people have trouble working out how a Wien bridge can be engineered to run at a constant stable amplitude. My opinion is that this always requires adding some kind of non-linear element to control the gain around the loop, and if you want a low harmonic content in the output you generate, and a precise output level, this has include a precision rectifier or demodulator whose output can be compared with a stable reference voltage to generate the gain-adjusting signal.

Less picky individuals tend to cut corners, and so have I when the application is less demanding.

Some may be castrated males but, according to my dictionary they are used for draught, for milk or for meat. Unless you are going to tell me you have succesfully milked a bull, "Stupid Cow" makes sense.

The dictionaries I've consulted concentrated on the draft animal aspect. Ignorant people do use words on the basis of their idiosyncratic understanding of what they mean, but the intelligent ignorant do generally learn to do better.

Since I've never been in the bovine artificial insemination business, I can't ever claim to have "milked" a bull.

This has nothing to do with your bizarre equation of "stupid cow" which is purely English, with "oxymoron" which is comes to us from Greek. There is a word "boustrophedron" meaning

"written from right to left and from left to right in alternate lines."

which also comes to us from Greek, which does involve oxen, since the text is written onto the page in the same way that an ox plows a field, with the direction reversing every time the stream of text hits a page boundary.

It's a compound of "bous" - ox - and "stophos" - turning.

Electron beam microfabricators write their patterns in the same way, and for much the same reason - it takes time to get the beam/ox back to the other side of the field being written/plowed.

[...]

I am amazed that I managed to work in animal husbandry for 30 years and obtain a degree in biology without your helpful advice to enlighten my ignorance.

Well I have been in that business and I can assure you that the 'milk' you get from a bull is not something you would want to waste on your cornflakes, there are more productive places to put it (and it is very expensive to buy, if the bull is of good repute). I have no reason to doubt that the milk referred to in the dictionary confirms the common existence of oxen cows.

John Larkin has worked in electronics for just as long and still seems to need advice (not that he appreciates it when he gets it).

It's a cross-linguistic pun on oxymoron, and has no other justification. Puns don't make any sense at all, and the proper response to any pun is always derision.

That I have heard. The boarding school I got sent to in Tasmania for the last fours of my secondary education also looked after a lot of farmer's sons. My parents both had university degrees in chemistry, and chemistry didn't generate nearly as much discussion with my schoolmates.

A dictionary isn't a great place to find out the sex ratio of draft animals. They want to find examples where a word has been used - old examples are interesting, numerous examples much less so.

formatting link
gives the first 2200 words in the Kucera-Francis table of word frequencies in American English. It dates from 1967. Dictionaries go back rather further.

[...]

Perhaps you should ignore my puns in future and I, in return, shall ignore your advice on non-electronic subjects.

Puns always earn derision.

That's no kind of a fair exchange. I'm perfectly used to having my advice ignored on a whole range of subjects.

...but you don't always have to post your every thought, especially the copious negative ones.

It sounds as though I should expand the range of subjects to make it fairer.

She could become a second Donald Trump. The UK seems to be less well-supplied with gullible twits as the US, so it wouldn't have the career prospects of the American version, but Liz Truss might be a UK-specific role model. Liz Truss does seem to have ignored a great deal of good advice - not as much as Donald Trump, but enough to command quite a lot of well-deserved derision.

As the book "The Big Myth" demonstrates, US big business has been working on maximising the gullibility of American voters for decades, and it has paid off - if not a way that will help US big business. Protecting them from foreign competition isn't going to make them more efficient or more productive. Protection against foreign competition may be a way to get local industry going from scratch, but if you've off-shored all your manufacturing, tariff protection is less helpful.

formatting link

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required