# Hyperbolic tangent transfer function

Discussion in 'Electronic Design' started by John Popelish, May 10, 2005.

1. ### John PopelishGuest

Okay, please forget I mentioned toob sound. Thank you.

Does anybody have any suggestions for me on the best way to build a
precise, stable, symmetrical hyperbolic tangent transfer function
generator?

I have built (but not yet quantified the errors on) a circuit based on
the LM13700 dual transconductance amplifier. How can I do it better?

2. ### Kevin AylwardGuest

Yes.

Yeh....long live analogue...

Kevin Aylward

http://www.anasoft.co.uk
SuperSpice, a very affordable Mixed-Mode
Windows Simulator with Schematic Capture,
Waveform Display, FFT's and Filter Design.

3. ### James MeyerGuest

If I wanted to synthesize an arbitrary monotonic function, I'd start
with a string of diodes and resistors. PWL. Not piece-wise linear, but
piece-wise logarithmic.

Jim

4. ### Tim ShoppaGuest

precise, stable, symmetrical
For what range of inputs and what precision?

tanh(x)=x is pretty good for (within a few %) for x<0.3.

tanh(x)=1-2*exp(-x*2) is good to a couple of percent for x>1. For that
matter, tanh(x) = 1 is good to a percent for x>3 .

In between it's a matter of blending .

I think there's a section in the MIT Radiation Lab Volume 19 book
synthesizing nonlinear functions out of real-world compoents. I'll see
if I can dig it up. (Are these scanned and on the web anywhere?)

Tim.

5. ### Kevin AylwardGuest

It seems many posting here don't seem to be aware that the basic diff
pair is a tanh() function.

Iout = Ie.tanh(Vin/2Vt)

This will be quite accurate over many decades. So, why do anything at
all? Its all done!

Kevin Aylward

http://www.anasoft.co.uk
SuperSpice, a very affordable Mixed-Mode
Windows Simulator with Schematic Capture,
Waveform Display, FFT's and Filter Design.

6. ### Jim ThompsonGuest

Without checking my math, I do believe that an ordinary bipolar
differential pair has TANH for a transfer function.

Pretty small range, but can be built out. Look into some of Barrie
Gilbert's paper's.

...Jim Thompson

7. ### John PopelishGuest

I am passing the signal through this transfer function to prepare it
for an A/D converter. Using a 10 bit A/D this will give me something
between 12 and 16 bit resolution for the central 10% of the span, and
something like 6 bit resolution at the peaks. Creating the transfer
function with a 16 bit A/D DAC combination kind of defeats the purpose.

8. ### John PopelishGuest

Then I have to control temperature of those diodes or correct the
result for temperature variations. At least the PWL version can e
pretty stable. But either of these is more complicated than the
transconductance amplifier, I think. My difficulty is quantifying the
precision of the transconductance amplifier. If I had a temperature
controllable differential pair, I could use opamps to form the rest of
the circuit, and eliminate most of the tolerances.

9. ### John PopelishGuest

Thank you. I would like to see that.

It is my understanding that an ordinary differential amplifier made
with two junction transistors produce a tanh transfer function as the
difference of their collector currents, based simply on the physics of
their operation. See bottom of page 8:
http://ee215-files.stanford.edu/handouts/HO17_215W05_DiffAmp_2pp.pdf

The simplest way to extract this transfer function seems to be an
integrated transconductance amplifier, like the LM13700 (or CA3080),
but all those current mirrors add rather unspecified errors to the
front end transfer function.

10. ### John PopelishGuest

This is what I am counting upon.
There is a temperature term in there to be dealt with. My original
post called "Toob Sound?" described how I use the two spare darlington
transistors in the LM13700 chip and the voltage drop across the gain
control current mirror to devise a chip temperature control loop.
That seems to work pretty well. But all the current mirrors between
the differential pair and the current output are not very well
characterized, so I am worried about the final accuracy.

I could surround a differential pair with a few opamps and subtract
the two collector currents with that and eliminate the current mirror
errors, but I still need to control the temperature of the
differential pair. Perhaps I can get a dual pair and use one as a
heater to control the temperature of the other. I hate to have to
build an oven around the device.

11. ### John PopelishGuest

I would like very much to read Gilbert's papers, but I keep running
into IEEE requests for my membership number (which I don't have).

Okay, so the entire purpose of this tanh exercise is to do signal
companding, right? Any particular purpose for prefering tanh(x) over
the usual log(x) way of doing it? Also, what are your bandwidth and
cost requirements? One or the other must be pretty severe if just going
to a 16 bit ADC isn't a far easier option.

13. ### BanGuest

It will be quite an effort to get a stable output voltage, since the
differential amplifier transfer function has the factor (Vin/2Vt) in it, Vt
being the temperature voltage around 25.5mV at room temp.. Transistors need
to be matched, I recommend LM198 there can be an offset pot. With 0.1mA the
input impedance is 80k. You can use a PTC with +3300ppm to compensate for
the Ut temperature dependency.
The circuit is also useful to convert a triangle wave to a sin. the best
conversion is with +/- 2.8Ut=72mV. then the distortion is minimal 1.3%, but
can be lowered with an additional diode pair to 0.4%.
I paste you again my proposition here:

+15V
o
|
_V_
.---|___|---.
| 1k |
.-. .-.
| | | | R2_
| |R1 | |R1 +-|___|-GND
+/-10V '-'150k '-'150k |100k
o | | | |\
| | +-------+---|+\
.-. | | | >-+--o Uout
| | +-----------)-------+---|-/ | +/-10V
| |19k | | | |/ |
'-' | | | __100k|
| |/ \| +-|___|--+
+----| LM198 |-+ R2
| |> <| |
.-. | | ===
| / +-----+-----+ GND Uout=Ie x R2 tanh (Uin/2Ut)
,/| |
/-'1k | Ut=25.5mV
|PTC / \
| ( Ie)100uA
=== \_/
GND |
o
-15V
(created by AACircuit v1.28 beta 10/06/04 www.tech-chat.de)

14. ### BanGuest

Should be LM194 or 394

15. ### John PopelishGuest

The signal swings both ways from zero.
Right now, cost is not a factor, because I am exploring alternatives.
The bandwidth is less than 100 Hz. The signal spends 99+% of the
time within a few percent of zero. I am working on a means to connect
a seismometer to a PC, and one way involves using the very inexpensive
and available 10 bit converter sold by DataQ:
http://www.dataq.com/products/startkit/di194rs.htm
Right now, it is more of an educational exercise than a product.

16. ### MochueloGuest

Hi,

For that bandwidth, it would be better to use an ADC with 16 or 18
bits.

If you really want to use the (I agree, very cheap) datalogger you
mentioned, here's an idea: You could feed your signal to CH1, and also
a 10x version of it to CH2, using a simple amplifier. Depending on the
input circuitry, you might need protection zeners (two in anti-series,
from line to the 0 V node, at each channel input that would otherwise
be "overloaded"). You would then have two waveforms to look at: one 1x
and one 10x. During the time intervals where the 10x saturates, you
would look at the 1x. You could work out some signal processing (at
the PC) to (more or less) seamlessly convey them into one displayed
signal. You could use the time when none of the channel saturates to
"cross-calibrate" the dependencies (you would be calibrating your
analog amp).

Since the datalogger has four channels, you could extend the idea to
have {1x, 5x, 10x and 50x} simultaneous resolutions, for instance.

Best,
Mochuelo.

17. ### MochueloGuest

Well, if the output saturation voltage of your amp is lower than the
max input voltage of the channel input, of course you don't need
anything.

18. ### John PopelishGuest

Thanks for an interesting possibility that still allows the use of
this data logger.

19. ### James MeyerGuest

If size isn't a big concern, a small circuit board (or stack of two
boards) with the diode/resistor string and a resistive heater and a thermistor
placed in a styrofoam container could do the job. You'd then have access to all
the internal circuitry to tweak to your heart's content. A cube 2 inches on a
side would probably be big enough. OCXO's are about the same size.

Jim