Square-Rooting a Signal?

Started by thehallofshields, January 24, 2020, 12:27:13 AM

Previous topic - Next topic

thehallofshields

Looking at the Datasheet of the AD633 Multiplier, I came across this application:



When we multiply sine waves, we know that we get the sum and difference frequencies.
When we square a signal (multiply a signal with itself), we double it (octave). That math is easy to work out.

What happens when we 'divide' two signals?
How does the math work out when we squareroot a signal?
A google search turns up something like half-wave rectification, but is that accurate? If so, why?

DrAlx


thehallofshields

How different is that wave-form from half-wave rectification?

Rob Strand

#3
QuoteHow different is that wave-form from half-wave rectification?
There's one thing not made clear in that example.

sqrt(x) only makes sense for x >=0;  for x < 0 you get complex numbers.

When you do sqrt(sin(x)) it only makes sense for sin(x) >= 0.

So what missing is the part about throwing away the signal when it is less than 0.
ie. the thing that isn't mentioned is the fact there is half-wave rectifying going on
before you get to the sqrt(x) part in order to prevent complex numbers!
(the sqrt() *isn't* doing the half-wave rectification.)

So once you understand that mechanism the difference between sin(x) and sqrt(sin(x)) is the top of the sinewave becomes fatter like a soft clipped waveform.   Just notice sqrt(0.5) = 0.707 > 0.5   and sqrt(0.9) = 0.95 > 0.9 implying the top is flattened.

If you wanted to make a symmetrical sqrt() signal like you get with a clipped amplifier you would need to modify the sqrt() to be

a) Vout =   sqrt(Vin) for Vin >=0  and -sqrt(-Vin) for Vin < 0

There's many way to write this, which are all the same
b) Vout =   sqrt(Vin) for Vin >=0  and -sqrt(abs(Vin)) for Vin < 0
c) Vout  = sign(Vin) * sqrt(abs(Vin))

Where abs(x) = absolute value of x
sign(x) = the polarity (or sign) of x;   +1 for x > 0, -1 for x < 0, 0 or 1 for x=0 (whatever)



Send:     . .- .-. - .... / - --- / --. --- .-. -
According to the water analogy of electricity, transistor leakage is caused by holes.

Rob Strand

#4
I forgot to mention a simple way to do a power of x in analog electronics is with exp() and log() functions

x ^ p  =  exp(ln(x^p))  = exp(p * ln(x))   

So you have circuit which does ln(), multiply that signal by p, the put that through a circuit which does exp().
For square root you would use p = 1/2.

The ln() and exp() functions are implemented with transistors and diodes!   Look up logging circuits.
In principle they are straight forward but you can get practical problems with DC offsets.
------
Here's an old-style analog circuit that does square roots (from national semiconductor applications notes),
Send:     . .- .-. - .... / - --- / --. --- .-. -
According to the water analogy of electricity, transistor leakage is caused by holes.

Steben

#5
So you can bias it on the positive side right to a couple of hundred mvolts in order to make it useful for guitar? Or higher bias after a gain stage


But can't a BJT stage with a very carefully designed feedback do the same?
  • SUPPORTER
Rules apply only for those who are not allowed to break them

Rob Strand

#6
QuoteSo you can bias it on the positive side right to a couple of hundred mvolts in order to make it useful for guitar? Or higher bias after a gain stage

But can't a BJT stage with a very carefully designed feedback do the same?
Sure, there's plenty of ways of getting the general signal shape.   For a guitar they all end-up sounding different and there's no "correct" circuit.

The difference between those and square-root circuits (or any mathematical based circuits) is the the aim is to provide a mathematically correct square root and also to produce accurate square roots over a wide range of input levels.   For example you might build a true rms converter for a multimeter which needs both squaring and square-root circuits.   Here you want the calculations to be accurate.

See page 34 of,
https://www.americanradiohistory.com/Archive-Electronics-Today/ETI-Circuits-No-2-1978.pdf

Because this isn't such an easy task to do true-rms chips evolved.  Nowadays you might find a microprocessor with a A/D converter and the rms calculations done in software.
Send:     . .- .-. - .... / - --- / --. --- .-. -
According to the water analogy of electricity, transistor leakage is caused by holes.