On Mon, 6 Mar 2000, David VanHorn wrote: > Actually, I am looking for a generalized technique that will let me strip > odd harmonics. > I have an application that's using the boxcar as I described, both to > indicate distortion level, and to subtract said distortion from a signal, > but the odd harmonics have me stumped. > > I use one boxcar to take the signal, but of course it also passes the 2H, > 3H, 4H... right on up, though past the 4th it's pretty well damped since > it's an eight cap boxcar :) The second grabs the 2h and 4h components > perfectly, but I have no simple answer for 3h and 5h. (Maybe I only need > 3h, but you get the idea.) If you had a square wave with a 50% duty cycle, there are no even harmonics. Furthermore, the relative magnitude of the harmonics are inversely proportional to their harmonic numbers. If you vary the duty cycle to say 33%, you'll have no 3rd,6th, 9th harmonic, but some of the evens will pop up. I don't think there's a way to arbitrarily kill the odd harmonics. But you can do (at least) two things: vary the pulse width of individual pulses and vary the number of pulses. The plot: http://www.dattalo.com/ms1.gif cancels the 2nd and 3rd harmonics. You could say that it consists of three pulses; one twice as wide as the other. (But the program generating it had 4 bits for those 3 pulses...). I don't have time right now to explain, but as I mentioned earlier, it's possible to exactly cancel the first N harmonics. However, the number of 'time slots' or quantized positions at which the pulse edges may occur is of the order of N! (factorial). There is technique that involves examining the phases of the harmonics of the individual pulses. I found that pulses can be collected into groups that totally cancel one another at a given harmonic number. The smallest group I experimented with is just a pair. For example, for the second harmonic, the pulses are grouped in pairs. One pulse is 180 degrees out of phase with the other. The pairs for the second harmonic are two pulses separated by one pulse. For the third harmonic, the pulses are separated by two pulses. 2nd harmonic suppressed: 010100000000 000010100000 3rd harmonic suppressed: 010010000000 000100100000 Total pulse stream: 010110100000 So the objective is to discover the pairs that cancel at a given harmonic and then to find a set of pulses that will have complete coverage for each harmonic. I've done this for 24 pulses, but beyond that it gets pretty hairy... Scott