Quadruple distortion of a wave and the phases of the harmonics

# A better way to measure SNR

Published on August 11, 2019

For decades we have used the most simplistic (and stupidest) method of testing Signal to Noise Ratio (SNR). I've used this method over and over again, and I can tell you it has brought me nothing but misery in several cases. We just assume that harmonics fall off at a very steep rate after the fundamental. In fact, on most testers I've used, THD is the vector sum of only the first eight harmonics (2nd-9th) which equally represents both Odd and Even harmonics. Everything after the 9th harmonic is considered noise. But in one case that assumption destroyed a multi-million dollar sale to a customer, the reputation of a company, and two applications engineers, not to mention all the business that company lost in bringing this test solution to market in the amazingly lucrative WiFi space. This assumption led everyone down the wrong reasoning path and ended an entire product line. The reason was simple: Harmonics do not necessarily fall off after the 9th harmonic, in some cases they persist, and even get larger, depending on the problem, as you can see below. in an illustration I use in my book.

We can't assume that everything after the 9th harmonic (or 5th, or 11th, or whatever) is noise, we must screen better for harmonics, and my new discovery has now made that possible. Behold Bullard Laws of Harmonics #5:

### "The harmonics of a distorted sine wave will always start at 0, 90, 180 or 270 degrees relative to the fundamental, no exceptions."

This new law which I only recently discovered holds the key to improving SNR measurements. Harmonics are always aligned by phase to the fundamental, either 0 degrees, 90 degrees, 180 degrees or 270 degrees, and I mean with no slop! It's amazing to see, as in the illustration above where I show the phases of over 300 harmonics for a wave that was distorted unequally and randomly on both peaks, and unequally and randomly at the zero crossing. In fact, I submit that no matter what you do to a transfer function, you will always see the harmonics at those phases, and the noise will be at many different phases, but the odds of noise happening at those four exact phases are minuscule. In fact, if there is ever any doubt, sample twice! There is no way that a non-harmonically related signal can be phase aligned to the fundamental, it's just not possible! So how do we use this information to figure out which frequency bins are harmonics and which are noise?

The best way is to do an FFT on the captured wave and then convert all bins to Polar format so that we have both the magnitude and the phase. We normally do this anyway to get the magnitude, but sometimes, and I myself have preached this in the past, we simply do the magnitude conversion and forget the phase. I means who needs it? Well, now that this new law has come time light, perhaps we do need to look at the phase. It doesn't take that much more time. Now that we have the phase, scan all the values looking for phases of 0, 90, 180 and 270 and note which bins those are. Even if they are not in multiples of the fundamental bin, they could still be aliasing harmonics that didn't get rejected by your anti-aliasing filter. If the harmonic is big enough to slip through your anti-aliasing filter, why are you ignoring it? Shouldn't you be looking at it more closely?

Now, in reality, the angles of the waves in a spectrum are going to be the vector sum of the harmonics and the noise. We must allow some slop on either side of the 0, 90, 180 and 270 degree criteria. But the further from these values, the more likely the signal is noise, so there shouldn't be much slop, maybe just a couple of degrees. Again, if there is any doubt, sample again, and see if it matches again. If it's random noise, the phase will move from capture to capture, but if it is harmonically related to the fundamental, the phase will remain close to the previously measured value of 0, 90, 180 or 270 degrees. Then it's harmonically related, absolutely. We can probably even come up with a way of mathematically separating the harmonic energy from the noise energy by analyzing the phase to know which amount of the magnitude belongs to the harmonic and which belongs to the noise.

Now, you have your list of harmonically related bins, everything left over is non-harmonic, meaning it's noise. Don't worry about the fundamental and the DC bin. The fundamental bin is 0 degrees phase, by definition, and the DC bin is either 90 (for positive DC offsets) or 270 degrees (for negative DC offsets). Both of those fit Law #5 so they should be in the list of harmonically related bins. But be sure to exclude the Nyquist bin, we have no idea what is in there and the phase totally controls the amplitude making this bin worthless.

So now, do the vector sum of all of those remaining bins to calculate the total noise. That is, the square root of the sum of the squares of all the non-harmonically related bins, everything that didn't have a phase of 0, 90, 180 or 270 degrees relative to the fundamental. This time we are going to look in the magnitude portion of the spectrum, but we are using the phase portion to figure out which bins hold harmonics, whether they are multiples of the fundamental bin or not, because again, aliasing harmonics are not multiples of the fundamental bin, unless you run the value through Dan's Rules. Now Signal to Noise Ratio is just the signal amplitude divided by the total non-harmonic noise, regardless of whether the noise happens to fall in a bin that is a multiple of the fundamental. How much noise have you ignored in the past, assuming it was a harmonic, when it wasn't at all? And you could have figured that out if you had simply looked at the phase! If it matches Bullard Laws of Harmoics #5, it's a harmonic, if not, it's not a harmonic, and thus, it's noise.

Had we done this with our customer in Taiwan, Nextest would be a world leader in Mixed Signal test. And Teradyne? They would be begging Nextest to buy them. Instead, millions of dollars were wasted, tens of people lost their jobs and a really great product died an untimely death, only because of an assumption, that the first eight harmonic bins are all you need to worry about, everything else is noise. And you know what they say about making assumptions...