# measures for quantifying non-linearity of a HF linear power amplifier

I am DIYing a class-AB HF Linear Power amplifier. How to quantify the non-linearity of this amplifier. What are the common measures of non-linearity as applicable to RF power amplifiers? How to measure them? Any good reference on these parameters would be really helpful.

I have:

• 20MHz dual trace oscilloscope,
• RTL SDR dongle,
• ubitx transciever,
• 30V/20A power supply.
• I am planning to get hold of a nanoVNA as well
• A common measure of amplifier nonlinearity is percent total harmonic distortion, suggest you search on this for the full story. – niels nielsen Jan 2 '20 at 8:37
• There's a lot of resources out there! For example: rohde-schwarz.com/ca/applications/… – Marcus Müller Jan 2 '20 at 11:28
• You'll often start by finding the 1 dB compression point. That's already a good term to search for; there's really a lot of theory here :) But you might really want to extend your question by telling us what measurement and RF generation equipment you have; for example, the R&S guide I linked to above assumes you have a known-power signal source AND a spectrum analyzer. Neither of which everyone has :) – Marcus Müller Jan 2 '20 at 11:29
• Thanks @MarcusMüller for sharing the resource. This seems to be a good document to start with. About the testing instruments i have : 20MHz dual trace oscilloscope, RTL SDR dongle, ubitx transciever, 30V/20A power supply. I am planning to get hold of a nanoVNA as well. But a spectrum analyser is out of reach. – SRK Jan 3 '20 at 3:48

You can do quite a lot with the RTL-SDR as a "spectrum analyzer". A proper spectrum analyzer will be accurately calibrated to measure absolute power, but if you can fix the gain of the RTL-SDR and the receiving software you can use it to make relative power measurements which are sufficient if you only want to roughly quantify linearity.

You could dump the transmitter into an attenuator and hook it straight into the RTL-SDR. Of course you'll have to ensure the attenuation is sufficient so as to not damage the RTL-SDR, and your attenuator will have to be able to handle the output power and consequent heat.

But it's likely with this approach you'll encounter a problem with leakage. Unless the shielding on your transmitter, RTL-SDR, and all the cables and such between them is superb, you'll end up receiving a lot of leakage that isn't actually making it to the output: the LO of the radios, mixing products which are removed by filters, and so on.

One solution is to invest in a suite of lab-grade equipment. But a cheaper solution is to just hook up an antenna to the amplifier, and take the RTL-SDR outside at least some hundreds of feet away. Whereas an inline attenuator will attenuate the "transmitted" signal but not the leakage, simply adding distance attenuates both signal and leakage equally, rendering the leakage relatively insignificant.

With your measurement apparatus set up, good things to measure are the 1dB compression point and 3rd order distortion.

To measure 1dB compression, you apply some input power and measure the output power. Comparing the two yields some gain. Then you increase the input power. For an ideal linear amplifier, the gain remains the same regardless of the input power. But with a real amplifier, you'll find at some level of input power, the gain starts to decrease. The point at which gain is 1dB less than it was at lower powers is the 1dB compression point. This gives you some idea of how hard the amplifier can be driven before it becomes nonlinear.

To measure 3rd order distortion, you feed it two tones. (Protip: psk31 and variants in idle state is such a signal, so you can use psk31 software to generate the signal.) An ideal amplifier would produce the same two output tones, but a nonlinear amplifier produces sidebands spaced at regular intervals equal to the tone spacing. As input power increases, these sidebands grow faster than the intended signal. By measuring the difference in power between the sidebands and the main signal over a range of input powers, you can plot the third order intercept point, and oft-quoted measure of linearity.

The final challenge is validating your measurements, since they will include distortion from the transmitter and the receiver, and the RTL-SDR isn't exactly certified. You'll note all these distortions get worse with increasing power, so a quick sanity check is to insert an attenuator at the input to the RTL-SDR and see if the distortion decreases. If so, the distortion you are seeing is predominately from the RTL-SDR, and you should add more attenuation. If not, the distortion is being generated from the transmitter and your measurements are good.

# Super-Light intro to nonlinearities

## Amplifier model

Ideally, an amplifier has this output function $$f(x)$$, where $$x$$ is the input amplitude:

$$f_\text{ideal}(x) = a_1 x\text,$$

and we call $$a_1$$ the amplitude gain (which is inherently the square root of the power gain).

Sadly, real amplifiers don't have ideal behaviour, instead they have:

$$f(x) = a_1 x\text + a_2 x^2 + a_3 x^3 + a_4 x^4 + \ldots$$

The $$a_i$$ can be positive, negative, whatever the physics of the amplifier makes them.

A good amplifier has a $$|a_1|\gg |a_2| ,|a_3| , |a_4|,\ldots$$.

As a general rule of thumb, a sensibly designed amplifier

## Intermodulation products

Now, why is $$a_2$$, for example, a problem?

Let's look at

$$f_{2}(x) = a_2 x^2\text,$$

where we've simply set all $$a_i=0$$ except $$a_2> 0$$.

Let's feed in a single tone, $$x=\cos(\omega t)$$ at frequency $$f = \frac{\omega}{2\pi}$$:

\begin{align} f_2(\cos(\omega t)) &= a_2\left(\cos(\omega t)\right)^2\\ &=a_2\cos(\omega t)\cos(\omega t)&\hspace{-8em}\text{trigonometrics: }\cos(a)\cos(b) &= \frac12\left(\cos(a+b)+\cos(a-b)\right)\\ &=a_2\frac12\left(\cos(\omega t + \omega t) + \cos(\omega t - \omega t)\right)\\ &=\frac{a_2}2 \left(\cos(2\omega t) + \underbrace{\cos(0)}_{=1}\right)\\ &= \frac{a_2}2 \cos(2\omega t) + \frac{a_2}{2} \end{align}

Oooops! We've built a frequency doubler! That's where the harmonics on even multiples of the fundamental frequency come from: from $$a_i\ne 0$$ where $$i$$ even. And the fact that the double frequency is far away from the input frequency allows us to cancel that effect with a simple low-pass filter.

Now, what happens if we have two tones, e.g. $$x=\cos(\omega_1 t) + \cos(\omega_2 t)$$? We get harmonics at $$2\omega_1$$, $$2\omega_2$$, $$\omega_1 + \omega_2$$ and $$|\omega_1\omega_2|$$.

Good news is, if $$\omega_1$$ and $$\omega_2$$ are close together (relative to their value, e.g. $$\frac{\omega_1}{2\pi} = 14.1\,\text{MHz}$$, $$\frac{\omega_2}{2\pi} = 14.2\,\text{MHz}$$), then these intermodulation products will also be "far away" from the frequencies we care about, and we can filter them away. By the way, that's the difference between an amplifier and an active mixer: The amplifier has large $$a_1$$ and small $$a_2$$, and the mixer has large $$a_2$$ and small $$a_1$$. All amplifiers are (bad) mixers!

The math becomes longer, but also stays boring (and that's why I'm leaving it as an exercise for the reader) for $$a_3\ne0$$: You get intermodulation products that are close to the original frequencies, namely at $$\omega_1 \pm |\omega_2-\omega_1|$$ and $$\omega_1 \pm |\omega_2-\omega_1|$$, and since that frequency difference was small to begin with, these products land in our band of interest and can't be simply filtered out.

# Practical measurements

I have:

• 20MHz dual trace oscilloscope,
• RTL SDR dongle,
• ubitx transciever,
• 30V/20A power supply.
• I am planning to get hold of a nanoVNA as well

That's not half bad; I'd say, get a few attenuators, too, and you've got a basic setup!

None of the following is done over-the-air, but with cabling in between devices.

I don't know the UBITX, but you say it's a transceiver. If you can use TX at the same time as RX on that device, you can replace the RTL-SDR below all with the RX side of your UBITX.

1. Use the ubitx (-> somewhere between 16 and 20 MHz low-pass filter) -> attenuator -> RTL-SDR to calibrate:
• Make sure all cables are reliable (this is like embedded debugging – you wouldn't guess how much headache unreliable connections cause), and all connectors are screwed on to a proper connection (don't overtighten them. Coax connectors can be damaged by too much force.)
• Start with a strong attenuator to avoid frying the RTL-SDR.
• Disable any AGC on the RTL-SDR.
• Send a pure tune at say 1/8 of the max digital amplitude, at medium TX gain, at say 14.00 MHz using your UBITX (if you can, use offset tuning – I don't know the ubitx, but you want to have LO leakage, if existent, to be out of band)
• Tune the RTL-SDR to let's say 14.35 MHz, sampling rate 1 MHz.
• Use a spectrum plot (in a pinch, a high-length FFT display will do!) and note down the "digital" power for the one tone you see. (better: Use a parametric spectrum estimator that finds the N strongest tones)
You should see a very dominant peak at 14.00 MHz; verify that you're far away from Full Scale of the RTL-SDR (or that will be what introduces your nonlinearities).
If you see more than one peak (higher than say -45 dB of the main peak), try reducing the gain of the RTL-SDR.
• A good rule of thumb is that the time domain signal (i.e. as if you hooked up an oscilloscope to the baseband signal) should be -10 dB from full scale (i.e. typically "1/10").
• Write down all the settings: TX gain, TX amplitude, frequencies, the attenuator you used, the RX gain, sample rate, FFT length... Everything you can configure must be reproducible. (This is like debugging an embedded system!)
2. You now have a relatively calibrated transceiver pair, i.e. when you increase the amplitude or power on the transmitter by x dB , you see the same x dB on the receiving end. Great! Test whether that's true, and for which range of transmit powers. This gives you the range over which this measurement setup works linearly and can be used.
• Note down what you see on 14.00 MHz. Tune to 28.35 MHz; note down what you see at 28.00 MHz. Since the RTL-Dongle isn't calibrated to have the same amplitude response over the whole frequency band, this doesn't say much as it – but we'll compare this number later! (The filter should eliminate the 28 MHz spurs from your transmitter completely – these thus are effects of the RTL-SDR, so we need to ignore them later on). Optimally, you see nothing but noise floor here.
• That means that when you send two tones in a small frequency distance on the UBITX, you'll also only see these two tones on the receiving end. And they should have the same amplitude. Test that! If you see new tones appearing: That's the intermodulation of one tone with the other. Reduce amplitude / gains.
3. add the amplifier and enough attenuation to (at least) compensate its gain between the UBITX (-> filter)-> and the attenuator we used so far. Power it.
4. If the amplifier is perfectly linear, then gain + attenuation would cancel out, and we'd just see the input at the output (plus maybe a little more attenuation, because you probably don't have exactly the same attenuator as your amplifier has gain, but that doesn't matter at all).
5. Send a single, low-power tone. Make sure that your RTL-SDR is far from saturation (e.g. via time domain signal). If not, add more attenuation.
6. SLOWLY increase the tone's power. You'll observe that over the range that was our measurement range above, the x dB input power increase -> x dB output power increase doesn't hold. You might need to add more attenuation at some point. That simply gives you two measurement curves; one with, and one without the extra attenuation.
• This is one figure of merit: You now know how much, on your frequency that you'll be using, the amplifier really amplifies for a given output power. At some point, pumping more power into the amplifier has diminishing returns!
• When you plot the output vs input power graph, you'll be able to read the 1 dB compression point from that. Save that graph! You'll need the curve later on
7. Do the same – but do it for the 28 MHz frequency! That's the second order intermodulation product
• Make a curve for second order output vs input power. Save that graph.
8. Find the second order intercept point: Figure borrowed from RF Wireless world, which I've never heard of before asking google just now. You combine the two graphs above into one and find the intercept point if you "extend" your curves with a straight line.
• rule of thumb: stay 10 dB away from IIP2 for acceptable linearity
9. Same, but with two tones, and just looking at the spurs in the 14 MHz band; gives you IIP3.

These are the two main figures you usually use to describe how (non)linear an amplifier is.

# Now what?

Armed with knowledge of IIP2 and IIP3, you know how much you can put into your amplifier until it becomes very nonlinear, and can, through extrapolating your curves, also estimate how much power you'll see on the even and odd harmonics. That helps you decide on filters!

## Predistortion

However, that's kind of a sad thing: our amplifier uses its power to produce unwanted frequency components, that we then have to put effort into suppressing. Sad!

What if we could take the $$f(x)$$ equation, measure the $$a_i$$, and find something like a "good" inverse function $$g(x) \approx {f^{-1}(x)}{a_1}$$, so that we can apply that function $$g$$ to the signal we actually want to send:

$$f(g(x)) \approx a_1 x$$

That would be awesome, because now we're just using our amplifier to produce the signal we want, and none of the intermodulation products.

This technique exists, it's called predistortion (which makes sense, since $$g$$ definitely distorts $$x$$, but only in a manner that "pre-reverts" the distortion of $$f$$). And, good news, your UBITX is a software defined radio, so you can calculate $$g(x)$$ on your PC and send it to your UBITX instead of sending $$x$$. Yay!

Caveats:

• Needs software to do that
• $$f(x)$$ isn't actually fully invertible – so perfect predistortion won't happen, but you can significantly reduce out-of-band radiation. Professional radio equipment does predistortion for that very reason.

Here's a talk by a friend of mine, MW0LNA on doing exactly that: predistortion in the digital domain.

• I think you mean third order intercept point. – Phil Frost - W8II Jan 3 '20 at 17:53
• @PhilFrost-W8II where exactly? When you measure the power in the second order intermodulation products, you find the second order intercept point. – Marcus Müller Jan 3 '20 at 18:55
• Minor obvious error in one equation I am in no position to edit. You have "a2 >>a2, a3..." I think you mean "a1>>a2,a3...". Excellent explanation – Chris K8NVH Jan 6 '20 at 17:51
• @ChrisK8NVH thank you! – Marcus Müller Jan 7 '20 at 7:04