Inverse Transfer Functions.
I wrote something on the 'random noise' page about the inverse of a nonlinear function, but looking at that again I think I should have explained it better. For example if we had a 'square law' amplifier with input x giving output x2 then we would reasonably guess that the inverse would be a square root function, which with input x2 would have output x. The problem is that the square law is one of the exceptions, which has no inverse. What we have overlooked is that a square root is not a single value, for example the square root of 4 is +/- 2. In practice when we talk about a 'square law' amplifier the transfer function is just a limited range of the x2 function, and is also offset so that there can be negative input and output voltages. A possible transfer function would be 10x + 5x2 restricted to x values greater (i.e. more positive) than -1. For x less than -1 an identical output can be produced by another value of x greater than -1, so the output can't be used via an inverse function to determine a unique value of input.
Here is a plot of y = 10x + 5x2:
Here we see that for example if y = 0 there are two possible values for x, either 0 or -2, so unless we limit the range of x to be -1 or greater we are unable to determine x as a unique function of y.
Suppose what we want is a linear function, y = 10x, shown as a red line on the plot, how can we derive the function we need to apply to y ( for x > -1 ) to get a final output 10x? The derivation is shown next, as a hand-drawn image:
The resulting function f2(y) is plotted next:
If the original input Vi = x varied from -1 to +1 then the first plot shows y will vary from -5 to +15,
and the second plot shows that for y varying from -5 to +15 the output Vo will vary from -10 to +10, as expected from our aimed for overall linear transfer function Vo = 10x.What we find is that for a sinewave input A.sin(wt) output y will include a second harmonic and also a DC term, but after passing through the second stage Vo is now just 10A.sin(wt) so the second harmonic and DC terms have vanished.
Suppose instead we reverse the function and its inverse, so we apply the sinewave to the f2(y) stage followed by the f1(x) stage. After the first stage we will now find (theoretically) an infinite series of harmonics, and these also will all vanish after the second stage, and again we get just 10A.sin(wt) at the final output. That should perhaps be obvious to the mathematically adept, but just to check I plotted the overall transfer function, taking out a couple of factors of 10 to keep it simpler, and here is the resulting straight line. (The vertical scale should be multiplied by 50.)
I avoided trying to calculate that infinite series of sinewaves for the function involving a square root. The only obvious method I thought of is to do a 'binomial expansion' and then work out the powers of the sinewave. The binomial expansion gives an infinite series and tells us there will be an infinite series of harmonics, but actually calculating the relative levels looks difficult. Maybe there is an easier method, but my mathematical skill is severely limited, so I'll leave it there.
One thing we can learn from this is that although a 'square law' amplifier only adds the relatively unobjectionable second harmonic to a single sinewave, if we have a more complex music signal with a fundamental plus a long chain of harmonics then it is possible for the amplifier to eliminate all those harmonics to leave just a single sinewave. That would be unlikely to ever occur in practice, but it is theoretically possible if all the harmonics had exactly the right levels and phases.
UPDATE:
An inverse transfer function can be generated by putting the original non-linear transfer function in the feedback loop of an op-amp. The first diagram below shows this, with a square-law stage in the feedback path for an op-amp with open-loop gain -1000. To get an exact inverse function we would need infinite feedback loop gain, but gain 1000 will give a good approximation.
Having created the inverse function we could then pass the result, V3, through an identical square-law stage to get back close to the original signal Vin. We don't need to do that because V3 is already applied to a square-law stage to generate V4, and we can just redraw the circuit as in the second diagram, and we now just have a simple feedback amplifier with a high gain op-amp input and a square-law output stage. We have made no change to the circuit operation, so V3 is still the inverse function, and as I wrote near the start of my Random Noise page, the inverse of the output stage transfer function has been created at its input. V3 will be the square root function derived previously, and will have a theoretically infinite series of harmonics for a single sinewave input at V1. If we assume the opamp input stage is perfectly linear then V3 is just V2 multiplied by -1000, so V2 has the same infinite sries of harmonics as V3, but 1000 times smaller. These same harmonics must therefore also appear as part of the final output V4 from where they are fed back to contribute to V2. But the harmonics at V4 are only 500 times smaller than at V3 because the 10k feedback resistors reduce the effect at V2 by a half. So, what this shows is that to a good approximation, the output distortion has the harmonic structure of the inverse transfer function, but reduced by the 500 gain round the feedback loop. We would need an infinite loop gain to get a perfect inverse function and therefore zero distortion at the output (V4).
Using AIM-Spice, (and I assume any other versions), we can do 'DC Transfer Curve Analysis', which plots the transfer function for an input Vin which can be swept over a specified range, in this example -0.5V to +0.5V. A 'Non-linear Dependent Source' B1 is used to generate voltage v = v(3)+0.5*V(3)^2 where V(3) is whatever voltage appears at node 3 in the circuit. This is just a typical 'square-law' amplifier stage response.
What we find is that V3 is almost exactly identical to the inverse transfer function previously calculated and plotted in the second plot on this page, apart from a left-right inversion. The calculated and simulated results are therefore more or less the same.
It is also confirmed that the open-loop distortion spectrum of the square-law amplifier is transformed by feedback into the spectrum of the inverse, square-root transfer function, which is why in this case adding feedback changes the distortion spectrum from just second harmonic to an infinite series of harmonics, but at a very low level. Some transfer functions have an inverse which doesn't add new harmonics, so the square-law is just a 'worst case' example.