If you get the LSE "perfect" with the 16-step/7-resistor design, then
the first fourteen harmonics are ZERO.
The even harmonics are of course zero, by construction, but the odd
ones are not, unless you call "8*10^-4" zero (and having assigned the
value "1" to the fundamental).
With the AOE values {57.6 30.9 23.7 22.1 23.7 30.9 57.6}:
harmonic[ 0] : 0.0000000000 (-234.4 dB)
harmonic[ 1] : 1.0000000000 ( 0.0 dB) Fundamental
harmonic[ 2] : 0.0000000000 (-319.7 dB)
harmonic[ 3] : 0.0005555000 ( -65.1 dB) <-- not zero
harmonic[ 4] : 0.0000000000 (-335.2 dB)
harmonic[ 5] : 0.0008047148 ( -61.9 dB) <-- not zero
harmonic[ 6] : 0.0000000000 (-344.6 dB)
harmonic[ 7] : 0.0001848441 ( -74.7 dB) <-- not zero
harmonic[ 8] : 0.0000000000 (-335.2 dB)
harmonic[ 9] : 0.0001437676 ( -76.8 dB) <-- not zero
harmonic[10] : 0.0000000000 (-349.0 dB)
harmonic[11] : 0.0003657795 ( -68.7 dB) <-- not zero
harmonic[12] : 0.0000000000 (-344.7 dB)
harmonic[13] : 0.0001281923 ( -77.8 dB) <-- not zero
harmonic[14] : 0.0000000000 (-336.6 dB)
harmonic[15] : 0.0666666676 ( -23.5 dB) <-- large
harmonic[16] : 0.0000000000 (-669.5 dB)
harmonic[17] : 0.0588235305 ( -24.6 dB) <-- large
harmonic[18] : 0.0000000000 (-338.8 dB)
harmonic[19] : 0.0000877105 ( -81.1 dB) etc
harmonic[20] : 0.0000000000 (-349.1 dB)
....
With your values {30.1 16.2 12.4 11.5 12.4 16.2 30.1}:
harmonic[ 0] : 0.0000000000 (-228.8 dB)
harmonic[ 1] : 1.0000000000 ( 0.0 dB) Fundamental
harmonic[ 2] : 0.0000000000 (-323.8 dB)
harmonic[ 3] : 0.0000046094 (-106.7 dB) <-- not zero
harmonic[ 4] : 0.0000000000 (-328.6 dB)
harmonic[ 5] : 0.0003879629 ( -68.2 dB) <-- not zero
harmonic[ 6] : 0.0000000000 (-331.2 dB)
harmonic[ 7] : 0.0000764662 ( -82.3 dB) <-- not zero
harmonic[ 8] : 0.0000000000 (-341.2 dB)
harmonic[ 9] : 0.0000594737 ( -84.5 dB) <-- not zero
harmonic[10] : 0.0000000000 (-335.7 dB)
harmonic[11] : 0.0001763468 ( -75.1 dB) <-- not zero
harmonic[12] : 0.0000000000 (-338.2 dB)
harmonic[13] : 0.0000010637 (-119.5 dB) <-- not zero
harmonic[14] : 0.0000000000 (-340.7 dB)
harmonic[15] : 0.0666666676 ( -23.5 dB) <-- large
harmonic[16] : 0.0000000000 (-655.0 dB)
harmonic[17] : 0.0588235305 ( -24.6 dB) <-- large
harmonic[18] : 0.0000000000 (-342.9 dB)
harmonic[19] : 0.0000007278 (-122.8 dB) etc
harmonic[20] : 0.0000000000 (-342.6 dB)
....
Better, but not perfect.
Intuitively speaking, you can't cause (other than by chance) n perfect
independent zeros with m adjustable variables, being n>m. m equals 4,
for you. If the value of each variable can be chosen from a set with a
_finite_ number of possible values, as is your case (if you want to
use standard E96 values), the situation can only be worse.
What I was saying is that, assuming that your choice minimizes the sum
of squared errors (which I haven't checked), in general, there may be
a _different_ choice that causes the THD to be lower than in your
case. If I have time I will try to find an example to prove this.
Higher harmonics are NON-ZERO, actually pretty large, and (as long as
you're limiting yourself to 7 resistors and equal-spaced steps and want
the first 14 harmonics to be zero) you have NO CONTROL of them
because... you've only got 16 fixed-spacing steps!
Any real analysis has to include the effect of the low-pass filter that
follows our primitive DDS. My decoupling (saying "first we get rid of
the first 14 harmonics in synthesis to make the work of the low-pass
filter easier") may indeed be primitive and not a good decoupling.
If you have any reference to real designs or published literature that
do DDS-like (e.g. equally spaced steps) or other numerically-controlled
oscillator sine-wave synthesis and do NOT simply choose sin(phase) for
equal phase spacing, I'm very interested. DDS has become very popular
over the past decade or so but none of the published designs or chips
I've seen use anything but sin(phase) for equally-spaced phase in their
lookup table.
I'm not completely disinterested in designs that use diode-limiting on
triangle waves (you will note that these often do use non-equal spaced
steps) but I'm convinced that I'm already doing better than all of
those. I'm also convinced that I do much better than
8038's/XR-2206's/etc (which are essentially "slope and trip-point
synthesizers")
Don's "Magic Sine Waves" seem interesting but there's a lot more steps
I don't like using the word "magic" for non-magic things. For the same
reason, delta-sigma modulation could be called magic modulation, the
fast Fourier transform could be called the magic transform, etc. For
me, it is like saying "this is so complex that it has to be called
'magic.'" It is ok if I'm talking to a 10-year old kid, but not if I'm
talking to engineers.
going on in his PWM than his accounting says there are
. And I'm
working with fairly conventional microprocessors and logic so his
methods run out of steam real quick above a kHz or so (whereas the
16-step-7-resistor thingy is good to several MHz, a place that magic
sine waves will not go).
If you need to work with low ratios (clock/output_f), maybe you can
run a long simulation to find the optimum sequence of 0s and 1s (and
even the values of resistors, if you want to work with more than two
levels) that produce the signal with the spectral contents that you
want. Just brute force would work (for low ratios), but a minimization
algorithm would help.
Best,