Xref: utzoo comp.ai.neural-nets:199 sci.electronics:3679 Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!husc6!bu-cs!buengc!bph From: bph@buengc.BU.EDU (Blair P. Houghton) Newsgroups: comp.ai.neural-nets,sci.electronics Subject: Re: Sigmoid transfe function Message-ID: <917@buengc.BU.EDU> Date: 23 Aug 88 21:10:40 GMT References: <1982@aecom.YU.EDU> Reply-To: bph@buengc.bu.edu (Blair P. Houghton) Followup-To: comp.ai.neural-nets Organization: Boston Univ. Col. of Eng. Lines: 140 In article <1982@aecom.YU.EDU> krishna@aecom.YU.EDU (Krishna Ambati) writes: > >Concerning circuits that yield a tanh transfer function, I wonder >whether the following will work? > > D1 > > ____|/|___ > | |\| | > ---| |--- > | |____|\|___| | > | |/| | > | D2 | > | | > | | > | C | > |--------| |-------| > | | > | R | > |-------/\/\-------| > | | > | | > | |\ | > V(in) .-------|-------|-\ | > | \_______|_____. V(out) > | / > |-------|+/ > | |/ > | > GND > >What is the transfer function of this circuit? It's not tanh(Vin); that's for sure. I do want to thank you for unrusting my op-amp design talents. This was some fun! First, put a significant resistance (call it Ri) in series with Vin, or you'll get only a step at Vin crossing 0 where Vout goes from Vd to -Vd. Vd is the threshold voltage of the diodes (assume ideal diodes with forward resistance zero, reverse infinite; this assumption doesn't change the result too much.) Call the potential at the inverting input Vinv. It is the op-amp's duty to keep this voltage equal to the noninverting-input voltage, which you have tied to ground, or suffer nonlinearity. Now we have three cases: 1. |Vout - Vinv| < Vd, which is to say |Vout| < Vd, since this is the linear region, and the op-amp may do its job proudly. We find Vout R ---- = - ------------- ; Vin Ri + s C R Ri which, for low frequency (s) is approximately Vout R ---- = - --- ; Vin Ri and, it is a lowpass filter, so any frequency above 1/(RC) is significantly attenuated. For the purpose of "sigmoidality" we worry about all frequencies, especially the lower ones. But, neurons drive themselves and their peers. I won't worry here about what the lowpass characteristic does to neuromimetic activity. 2. Vout - Vinv >= Vd; Now the resistance of D1 drops to zero. R and C are well and truly shorted, and any current from the op-amp output can be fed back to the inverting input. Most importantly, that amount of current will be fed back which is equal to the amount taken by Vin; i.e., Vinv - Vin Vout - Vd - Vin I = ---------- = --------------- ; Ri Ri and the only truth about Vout is Vout = Vd + I Ri + Vin = Vout This means that the op-amp sets Vout at its convenience. Its convenience is to set Vout to keep Vinv = Vnoninv = 0; hence Vout = Vd . Here is where things can get ugly if you include the series resistance of the diodes. Practically, it only adds a little bit to the Vout vs Vin line, causing it to slope upward a bit, rather than being flat. One other effect of reality is a slight rounding at the point where regions 1 and 2 meet. 3. Vout - Vin <= Vd; See region 2 for the currents; since Vin and Vinv have both switched sign, I will have also. (Betcha didn't know that about me :-) The output volts are just Vout = -Vd . The full effect is | Vout | xxxxxxxxxxxxxxxxxxxx - Vd x | x | x| -----------------------x-------------------- |x Vin | x | x -Vd - xxxxxxxxxxxxxxxxx | So, what you have just invented (not really :-( ) is a double-sided clipping circuit that operates as a low-pass filter for small-signal input. With the slight rounding at the corners, this can be considered a "sigmoid", but you have to emphasize the "-oid" heavily. I think for the purposes of the Hopfield model it will work; just feed this one's output through another inverting amp with gain set so that Vin = Vd gives Vout = 1. It's easier to leave out the diodes and capacitor and run the thing with supply voltages of +/-1v. the op-amp will clip on its own. --Blair "Even an Electrical Engineer could do such a thing; I'm sure of it..."