DSPRelated.com
Forums

The z-plane's unit circle

Started by Rick Lyons December 13, 2012
On Thursday, December 13, 2012 2:41:36 PM UTC-5, robert bristow-johnson wrote:
> On 12/13/12 2:16 PM, Thomas Heller wrote: > > > Am 13.12.2012 12:00, schrieb Rick Lyons: > > >> > > >> I've been thinking about digital oscillators > > >> with regard to their implementation in > > >> fixed-point systems. > > > > > > What is the advantage of a digital oscillator against, say, > > > a DDS generator? > > > > *what* is the difference? > > > > i still haven't understood anyone who differentiates the concepts of > > "Direct Digital Synthesis" (whatever that means) and the good ol' > > "Numerically Controlled Oscillator" with the phase accumulator and such. > > > > i realize that, for different waveforms, that there are different ways > > of doing things, like for a simple square wave, you can have a simple > > count-down timer and toggle the output, or for a pure sine, you can > > synthesize it from an equation (or equations) similar to > > > > y[n] = 2 cos(omega) y[n-1] - y[n-2] > > > > (there's another pair of equations for quadrature synthesis) > > > > and with the typical NCO, it's a phase accumulator with table lookup > > and, perhaps, some interpolation. > > > > does not DDS include any of these methods? > > > > Rick (and group), isn't this largely a solved problem? > > > > > > -- > > > > r b-j rbj@audioimagination.com > > > > "Imagination is more important than knowledge."
It is largely solved. I put together a theory for large classes of oscillators. Also included are generalized AGC techniques and a generalized Goertzel algo where you can use almost any 2nd order osc. Choose one to suit your numerical needs. See http://www.claysturner.com/dsp/digital_resonators.pdf for a power point I gave at the comp.dsp conference in Kansas City Here is a table of parameters for a slew of oscillator designs http://www.claysturner.com/dsp/ResonatorTable.pdf Clay
Robert

I drew out the picture and I think it's like this;

Assume X and Y are the outputs of 2 registers.  

X(n+1) = X(n) - A*(Y(n) + A*X(n))
Y(n+1) = Y(n) + A*X(n)

Where A = sqrt(2-2*cos(theta))


As an experiment once I shocked this oscillator to life, left on vacation, and came back a week later. No amplitude drift at all. Of course I did fly over the Bermuda Triangle that week. Coincidence?

Bob
On Thu, 13 Dec 2012 17:12:39 -0500, robert bristow-johnson wrote:

> On 12/13/12 3:54 PM, Robert Adams wrote: >> >> Maybe we are thinking about different structures. If you put one >> delayed integrator and one non-delayed integrator in a feedback loop, >> and both integrators have a gain of sqrt(2-2*cos(feta)) then the >> quantization only effects the pole angle, not the radius. Hit it with >> an impulse and it rings at constant amplitude forever. Unless you >> change the frequency on the fly ..... >> >> > i'm thinking of two structures. both have two states (and i think that > any resonant oscillator needs two states). > > the common one with a single output: > > x[n] = 2 cos(omega) x[n-1] - x[n-2] > > and with initial states > > x[-2] = A cos(phi - 2 omega) > x[-1] = A cos(phi - omega) > > will oscillate with amplitude A and normalized frequency omega and > initial phase of phi. because the coefficient on x[n-2] is 1, it should > be a pretty stable amplitude if the rounding is to nearest and you have > a decent number of bits, even without AGC. the two initial states fully > determine the amplitude and phase, so when omega is suddenly changed, > you have to consider x[n-1] and x[n-2], along with your *new* omega as > initial states for a new stretch of oscillation. i s'pose i could work > out the math, but i'm too lazy to. you get a new A and a new phi > (extrapolating back to a hypothetical x[0]). it's certain that the > amplitude will change. to prevent that, you need to readjust x[n-2] > assuming that x[n-1] is precisely the sample you would want with the new > omega (having the same phase and amplitude). > > > the quadrature resonant oscillator i was thinking of is > > x[n] = cos(omega) x[n-1] - sin(omega) y[n-1] > > y[n] = sin(omega) x[n-1] + cos(omega) y[n-1] > > with initial states > > x[-1] = A cos(phi - omega) > y[-1] = A sin(phi - omega) > > if there were no numerical issues, the coefficients cos(omega) and > sin(omega) would always square and add to 1. and the two states would > always be the cos() and sin() of the same angle and they would also > square and add to A^2. > > but we know if, do to rounding, if the coefficients square and add to > less than 1, then x[n] and y[n] will together spiral slowly down toward > zero. and if the coefs square and add to more than 1, then the spiral > will increase at the same dB-per-sample rate. > > so, if A is specified, these coefs might need to be minutely adjusted > (maybe just the LSB) to keep the amplitude of the quadrature pair at A. > or, maybe make sure that the coefs are rounded *up* so that they > square and add to something slightly bigger than 1 and apply limiting to > x[n] and y[n] to amplitude A (that was my cheapie solution with a DSP > that has saturation arithmetic). > >> You can of course add an amplitude control loop by feeding back to the >> middle node. If you are clever you realize that since the two >> integrators have quadrature signals, > > i am not clever enough. i am not sure what the structure is you mean. > >> you can take the sum of squares as the amplitude control which has no >> ripple. > > just so that i know what you're saying, can you toss up a difference > equation that defines exactly what the output is as a function of the > two states? > > >> Bo > > you be the prez? (dunno if you saw those tweets from "-bo".)
RBJ: RA is thinking of a filter where A = sqrt(2 - 2 * cos(2 * pi * f_osc), x[n] = x[n-1] + A * y[n-1], y[n] = y[n-1] + A * x[n], To get AGC you modify the x[n] term to something like x[n] = (1+B) * x[n-1] + A * y[n-1], where you vary B to nudge the oscillator poles off of the unit circle. You can do that with your oscillator, to: x[n] = (1+B) * cos(omega) x[n-1] - (1+B) * sin(omega) y[n-1] y[n] = (1+B) * sin(omega) x[n-1] + (1+B) * cos(omega) y[n-1] where, once again, you vary B to nudge the oscillator poles off of the unit circle. (I said to do it with just the sine terms on mine, but I was _wrong_!!!! You need to do the whole thing, or you vary frequency along with damping and that's not good.) Your idea of rounding up in magnitude and letting saturation do the dirty work is probably OK, but would make it harder to predict the actual frequency and amplitude. If you want things to be dead nuts on then you probably want to do it with AGC. -- My liberal friends think I'm a conservative kook. My conservative friends think I'm a liberal kook. Why am I not happy that they have found common ground? Tim Wescott, Communications, Control, Circuits & Software http://www.wescottdesign.com
On Thu, 13 Dec 2012 05:55:01 -0800 (PST), clay@claysturner.com wrote:

>On Thursday, December 13, 2012 6:00:21 AM UTC-5, Rick Lyons wrote: >> Hi Guys, >> >> I've been thinking about digital oscillators >> >> with regard to their implementation in >> >> fixed-point systems. It occurred to me that >> >> our lives would be much simpler if instead of >> >> having to worry about a z-plane circle we only >> >> had to be concerned with a z-plane rectangle. >> >> >> >> [-Rick-] > >So what does the "corner" frequency represent?? > >Clay
Hi Clay, To quote Prez Obama, "Answering that question with specificity is above my pay grade." [-Rick-]
On Thursday, December 13, 2012 2:16:40 PM UTC-5, Thomas Heller wrote:
> Am 13.12.2012 12:00, schrieb Rick Lyons: > > > > > > Hi Guys, > > > I've been thinking about digital oscillators > > > with regard to their implementation in > > > fixed-point systems. > > > > What is the advantage of a digital oscillator against, say, > > a DDS generator? > > > > Thomas
Thomas, In an analysis application, the Goertzel algo uses a driven biquad oscillator to compute a fourier coefficient. It turns out you can use almost any oscillator in a Goertzel like approach. The advantage of different oscillator structures lies in their numerical properties. For example the biquad is numerically disadvantaged for very low frequencies (rel. to sample rate). But drop in a different osc and it can work very well for the low freqs. Try this with a DDS. Clay

"Robert Adams"  wrote in message 
news:a008e083-9869-4676-ad76-f1f170dc13dc@googlegroups.com...

I have used these on dsps with no sin table. They work great except if you 
change the frequency on the fly, the amplitude may change. Depends on when 
the coefficients change relative to the sine wave.


Bob
Sin table?  Ten commandments??

On Monday, December 17, 2012 9:00:05 PM UTC-5, Phil Martel wrote:
> "Robert Adams" wrote in message > > news:a008e083-9869-4676-ad76-f1f170dc13dc@googlegroups.com... > > > > I have used these on dsps with no sin table. They work great except if you > > change the frequency on the fly, the amplitude may change. Depends on when > > the coefficients change relative to the sine wave. >
Equiamplitude Quadrature oscillators won't have that problem. I've used them in FSK modems. Clay
> > > > > Bob > > Sin table? Ten commandments??