Distorted cosine wave with noise

Decades of ignorance

Published on August 26, 2019

Copyright © Dan P. Bullard

I used to be amazed at the likes of Fourier, Nyquist, Shannon, and even Matt Mahoney. No longer. They missed some really important stuff in the area of harmonics, and even now we are suffering because everyone gave up on understanding what it's all about. Everything out there on harmonics is useless drivel. Except for my discoveries. It cost us a lot over the years and I can prove it.

Above you see a cosine wave with a non-coherent noise signal imposed on it, about 10 times smaller in amplitude than the cosine wave. But that's not all, this cosine wave is not perfect, it's got a serious distortion imposed on it too; the upper peak is clipped. This is one reason we use spectrum analysis to look at waveforms: Looking at them in time domain is just not a reliable method of testing. In fact, just the other day, someone on Quora asked "How do you test a digital signal?" Someone answered "With a scope." I countered, a scope is for "scope dopes," use a digital tester, it's much more reliable. Boy, did I get an earful from the scope dope! But it's true, scopes are only for people who are who too stupid to use real test instruments. For digital, a digital tester is the way to go, and for analog, a mixed signal tester is the way to go. You have to be able to do an FFT to see what is really going on. Like this:

In blue, my color for Odd harmonics, you can see the fundamental in bin 1, just after the DC. And yes, there is some DC there, since the wave peak is clipped, but DC offset is not the thing that tells us that, per se. It's the humping pattern of Odd and Even harmonics that leave the fundamental. If you are clever, you can even work out what angle the distortion hit the cosine wave at, using the Bullard Laws of Harmonics #2. But then you can see the noise in bin 19, and it's pretty ugly because it's non-coherent. I made it that way. And what's the size difference between the signal and the noise? About 20dB, as the noise is one tenth the amplitude of the signal. Now, do a traditional SNR and THD test, assuming that the first 8 harmonics after the signal are due to harmonic distortion and assume that everything else is noise.

Compare that to my adaptive method where I also look at the harmonic phase angle relative to the fundamental and look for angles of 0 or 180 degrees according to Daver's Law, derived from Bullard Laws of Harmonics #5. Notice that the noise, being non-coherent, bleeds all over the harmonics caused by the distortion, and drags the phases away from the values of 0 and 180 (plus or minus 2 degrees, the value just below Dan's THD). That's because it's not related to the fundamental. The way we know that the noise in bin 19 is 20dB smaller than the fundamental is the fact that the sqrt(10318.91748) or 101.6 is about 10 times smaller than the fundamental amplitude at (not shown) sqrt(980100) or 990, an amplitude of just under 1V peak in Excel's FFT. So both Dan's SNR and the Traditional SNR got it right, about 20dB of signal to noise ratio, 19.64 in both cases, very, very close! Also the THD works out too, -26.28dB Traditional THD vs -26.29dB for Dan's THD. In fact, it's easy to see that the noise dragged the phases of the 8th and 9th harmonic far enough away from the expected 0 and 180 degree angles that those amplitudes were counted as noise in Dan's SNR, and not counted as harmonics in Dan's THD. So maybe 9 harmonics is a good assumption. Or is it....

Here is another case where the noise falls in a harmonics bin, the 7th harmonic.

And in the spectrum you can see that pretty clearly.

I assume you can count and see that the noise is 20dB below the signal, and in bin 7, an Odd bin, denoted by the blue color. See? That's just one reason to color code harmonics, it makes them easier to count! Now for the readout.

Notice that the Traditional THD and SNR numbers are now completely wrong, thanks to an assumption (that makes an ass out of u and me) but Dan's SNR and THD numbers are still pretty darn close to the old values. The Traditional SNR value is off by 22dB and the Traditional THD number is off by 8dB. And you can see why too. Only the second, third and fourth harmonics are considered distortion products because they are close to the expected values of 0 degrees and 180 degrees phase relative to the fundamental. And that giant signal in the 7th harmonic bin at -163 degrees is clearly not related to the signal. Any signal that is not related to the fundamental shares no phase relationship with it, and Bullard Laws of Harmonics #5 and its derivative, Daver's Law helps us decide which bins contain harmonics and which bins are unrelated to the fundamental, like noise. That noise signal in the bins near bin 7, like the 5th, 6th, 8th and 9th are dragged away from the phase values they should have been (like 0 or 180) because the noise signal was out of phase relative to the fundamental. And the chances of the noise being in phase with the fundamental are very small, one part in 36, (we allow a 10 degree window out of a 360 degree wave) which is pretty unlikely. And if it is, run it twice, the noise can't do that twice in a row, it's extremely unlikely!

So for decades SNR and THD tests have been done wrong, by assuming that the first 8 or 4 or whatever harmonics are all you need to look at to determine THD and SNR. Those scientists, engineers and professors were totally clueless about the Bullard Laws of Harmonics, from Law #1 to Law #5. Good thing I came along and fixed this before we started sending people in interplanetary vehicles to other planets. How much error can you stand in that kind of endeavor? Knowing that F-16s are flying up there with nary a single FFT ever run on their electronics scares the crap out of me!