This is prompted by the discussion of aliasing in the thread "Higher upsampling with minimum phase downsampling produces more aliasing" by 'jungledmnc'. My question is based on the observation that sampled rectangular waveforms can be reproduced exactly, using a trivial D/A converter (strobed latch), with no need for an anti-alias / anti-image filter. The only requirement is that the sample edges align with the waveform transitions. We know that rectangular waveforms have lots of harmonics that can run way above the supposed Nyquist limit, but in this case we can ignore that, with no fear of aliases or images, because the output is the exact waveform, edges and all, so it has to have the same spectrum. How can this be? My supposition is that the aliased components must align in such a way that they all cancel. Rather than risk my remaining few brain cells trying to compute this <g>, I figure that someone here has already done it. It seems like such an obvious question that it may even be a 'classic' demonstration, somewhere. Can someone point me in the right direction? Thanks, and best regards, Bob Masta DAQARTA v7.60 Data AcQuisition And Real-Time Analysis www.daqarta.com Scope, Spectrum, Spectrogram, Sound Level Meter Frequency Counter, Pitch Track, Pitch-to-MIDI FREE Signal Generator, DaqMusiq generator Science with your sound card!
Nyquist and rectangular waveforms
Started by ●July 18, 2014
Reply by ●July 18, 20142014-07-18
I don't think that's true. First of all nothing you sample will be exactly the same after D/A. Also the D/A convertors (at least for audio) contain an oversampling filter internally, so they actually do it for you. Similarly when sampling A/D convertors contain a LP filter. So you basically sample it and reconstruct it with oversampling without you knowing it. My previous question was about synthesis - if you synthesize something purely in digital domain, there you have the aliasing, because you are basically creating a signal with unlimited harmonic expansion in a discrete (limited) domain. Anyway I don't think anything like "alias cancellation" exists (or that's what I got from your post). jungledmnc _____________________________ Posted through www.DSPRelated.com
Reply by ●July 18, 20142014-07-18
Hi, there are many ways to look at it. One is as follows: Nyquist doesn't tell about what happens _between_ the samples. A rectangular waveform "... 0 0 0 0 1 1 1 0 0 0 0 ..." consists of individual "... 0 0 0 0 1 0 0 0 0 ..." pulses. Each of them is a sinc() function that just happens to be zero at all but one sample. Once I reconstruct the continuous-time equivalent waveform (analog lowpass filter), what happens between the samples becomes visible. _____________________________ Posted through www.DSPRelated.com
Reply by ●July 18, 20142014-07-18
>> "alias cancellation" existsyou'd be surprised. The key word is "Nyquist ISI criterion", it can apply in unexpected ways: A) Take any (audio) waveform and run it through a hard nonlinearity (i.e. "tanh"). The result is mathematically correct at the sample time instants - after all, we just computed it. However, it will alias like crazy for high-frequency input. For example, do a pitch bend up, and you'll hear aliases going down at the same time. B) Repeat the experiment, but at a higher sample rate. Now look up sample instants from A) in the B) waveform. They are identical! And still, the aliases are gone. How is that possible? (Hint: If I'd lowpass filter B) to the same rate as A), then the aliases disappear but the samples have to change) One engineering application of this idea is the "halfband" FIR filter, where every second output sample is identical to the input. This kind of filter cannot be completely arbitrary, but must obey a symmetry relationship in the spectrum (Nyquist ISI) that you could call "alias cancellation". _____________________________ Posted through www.DSPRelated.com
Reply by ●July 18, 20142014-07-18
> > > We know that rectangular waveforms have lots of harmonics > > that can run way above the supposed Nyquist limit, but in > > this case we can ignore that, with no fear of aliases or > > images, because the output is the exact waveform, edges and > > all, so it has to have the same spectrum. > > > > How can this be?one way to look at it is..... becasue the signal and the sampling rate are synchronized, all the alisas fall on top of the signal and/or its harmonics. Therefore no new frequencies are created. Mark
Reply by ●July 18, 20142014-07-18
On Fri, 18 Jul 2014 11:48:02 +0000, Bob Masta wrote:> This is prompted by the discussion of aliasing in the thread "Higher > upsampling with minimum phase downsampling produces more aliasing" by > 'jungledmnc'. > > My question is based on the observation that sampled rectangular > waveforms can be reproduced exactly, using a trivial D/A converter > (strobed latch), with no need for an anti-alias / anti-image filter. > The only requirement is that the sample edges align with the waveform > transitions. > > We know that rectangular waveforms have lots of harmonics that can run > way above the supposed Nyquist limit, but in this case we can ignore > that, with no fear of aliases or images, because the output is the exact > waveform, edges and all, so it has to have the same spectrum. > > How can this be? My supposition is that the aliased components must > align in such a way that they all cancel. Rather than risk my remaining > few brain cells trying to compute this <g>, I figure that someone here > has already done it. It seems like such an obvious question that it may > even be a 'classic' demonstration, somewhere. Can someone point me in > the right direction? > > Thanks, and best regards,By imposing your "sample edges align with waveform transitions" you are going beyond the (completely and totally) implied condition on the Nyquist-Shannon sampling theorem that the input signal is arbitrary other than bandwidth. Here's a counter-example: .----. .----. .---. .------. .-----. in: | | | | | | | | | | ----' '------' '-------' '----' '-----' '--- clock: * * * * * * * * * * .-----. .-----. .-----. .-----. .-----. out: | | | | | | | | | | ----' '-----' '-----' '-----' '-----' '- Do you see some information being lost here? -- Tim Wescott Wescott Design Services http://www.wescottdesign.com
Reply by ●July 18, 20142014-07-18
Tim Wescott <tim@seemywebsite.really> writes:> On Fri, 18 Jul 2014 11:48:02 +0000, Bob Masta wrote: > >> This is prompted by the discussion of aliasing in the thread "Higher >> upsampling with minimum phase downsampling produces more aliasing" by >> 'jungledmnc'. >> >> My question is based on the observation that sampled rectangular >> waveforms can be reproduced exactly, using a trivial D/A converter >> (strobed latch), with no need for an anti-alias / anti-image filter. >> The only requirement is that the sample edges align with the waveform >> transitions. >> >> We know that rectangular waveforms have lots of harmonics that can run >> way above the supposed Nyquist limit, but in this case we can ignore >> that, with no fear of aliases or images, because the output is the exact >> waveform, edges and all, so it has to have the same spectrum. >> >> How can this be? My supposition is that the aliased components must >> align in such a way that they all cancel. Rather than risk my remaining >> few brain cells trying to compute this <g>, I figure that someone here >> has already done it. It seems like such an obvious question that it may >> even be a 'classic' demonstration, somewhere. Can someone point me in >> the right direction? >> >> Thanks, and best regards, > > By imposing your "sample edges align with waveform transitions" you are > going beyond the (completely and totally) implied condition on the > Nyquist-Shannon sampling theorem that the input signal is arbitrary other > than bandwidth.Right! I was trying to think of some brilliant, information-theoretic way to frame this but could not. But basically you hit it - assuming the quantizer is synchronized with the signal phase and the type of the signal (square wave) puts a lot more information in the quantizer than a standard ADC.> > Here's a counter-example: > > .----. .----. .---. .------. .-----. > in: | | | | | | | | | | > ----' '------' '-------' '----' '-----' '--- > > clock: * * * * * * * * * * > > .-----. .-----. .-----. .-----. .-----. > out: | | | | | | | | | | > ----' '-----' '-----' '-----' '-----' '- > > Do you see some information being lost here?Phase? -- Randy Yates Digital Signal Labs http://www.digitalsignallabs.com
Reply by ●July 18, 20142014-07-18
On Fri, 18 Jul 2014 11:48:02 +0000, Bob Masta wrote:> This is prompted by the discussion of aliasing in the thread "Higher > upsampling with minimum phase downsampling produces more aliasing" by > 'jungledmnc'. > > My question is based on the observation that sampled rectangular > waveforms can be reproduced exactly, using a trivial D/A converter > (strobed latch), with no need for an anti-alias / anti-image filter. > The only requirement is that the sample edges align with the waveform > transitions. > > We know that rectangular waveforms have lots of harmonics that can run > way above the supposed Nyquist limit, but in this case we can ignore > that, with no fear of aliases or images, because the output is the exact > waveform, edges and all, so it has to have the same spectrum. > > How can this be? My supposition is that the aliased components must > align in such a way that they all cancel. Rather than risk my remaining > few brain cells trying to compute this <g>, I figure that someone here > has already done it. It seems like such an obvious question that it may > even be a 'classic' demonstration, somewhere. Can someone point me in > the right direction? > > Thanks, and best regards,I have worked through this sort of thing just for chuckles and yes, the harmonics and aliases thereof do magically cancel out. HOWEVER: One of my pet peeves about linear systems analysis is that we are so used to using the frequency domain to make computation easier, that sometimes we forget that it's just a tool that takes things from the ordinary old time domain to the esoteric and weird frequency domain so that we can do work on it where the math is easier, but leaves us with a result that still needs to be translated back into something meaningful. Then we run into a problem like this, where the answer is absolutely freaking obvious in the time domain -- if you put a square wave into a sampler and get an identical square wave out, then the harmonics &c MUST be getting magically canceled. There's no need to go off and check this in the frequency domain, because it's most obviously happening RIGHT HERE. Imagine a guy standing under a sign post that says "1st St" and "Main St", poking at an iPhone and muttering "now where the heck am I?". How you feel about that guy is how I feel about using the frequency domain when the time domain answer is as obvious as a slap in the face with a two day old fish. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com
Reply by ●July 18, 20142014-07-18
Randy Yates <yates@digitalsignallabs.com> wrote:> Tim Wescott <tim@seemywebsite.really> writes:(snip)>> By imposing your "sample edges align with waveform transitions" you are >> going beyond the (completely and totally) implied condition on the >> Nyquist-Shannon sampling theorem that the input signal is arbitrary other >> than bandwidth.> Right! I was trying to think of some brilliant, information-theoretic > way to frame this but could not. But basically you hit it - assuming the > quantizer is synchronized with the signal phase and the type of the > signal (square wave) puts a lot more information in the quantizer than a > standard ADC.Now, look to see how v.92 modems work. If you do it right, you can figure out where the sample points are, and arrange the signal to transition at the right time! -- glen
Reply by ●July 18, 20142014-07-18
On Fri, 18 Jul 2014 13:00:48 -0400, Randy Yates wrote:> Tim Wescott <tim@seemywebsite.really> writes: > >> On Fri, 18 Jul 2014 11:48:02 +0000, Bob Masta wrote: >> >>> This is prompted by the discussion of aliasing in the thread "Higher >>> upsampling with minimum phase downsampling produces more aliasing" by >>> 'jungledmnc'. >>> >>> My question is based on the observation that sampled rectangular >>> waveforms can be reproduced exactly, using a trivial D/A converter >>> (strobed latch), with no need for an anti-alias / anti-image filter. >>> The only requirement is that the sample edges align with the waveform >>> transitions. >>> >>> We know that rectangular waveforms have lots of harmonics that can run >>> way above the supposed Nyquist limit, but in this case we can ignore >>> that, with no fear of aliases or images, because the output is the >>> exact waveform, edges and all, so it has to have the same spectrum. >>> >>> How can this be? My supposition is that the aliased components must >>> align in such a way that they all cancel. Rather than risk my >>> remaining few brain cells trying to compute this <g>, I figure that >>> someone here has already done it. It seems like such an obvious >>> question that it may even be a 'classic' demonstration, somewhere. >>> Can someone point me in the right direction? >>> >>> Thanks, and best regards, >> >> By imposing your "sample edges align with waveform transitions" you are >> going beyond the (completely and totally) implied condition on the >> Nyquist-Shannon sampling theorem that the input signal is arbitrary >> other than bandwidth. > > Right! I was trying to think of some brilliant, information-theoretic > way to frame this but could not. But basically you hit it - assuming the > quantizer is synchronized with the signal phase and the type of the > signal (square wave) puts a lot more information in the quantizer than a > standard ADC. > > > >> Here's a counter-example: >> >> .----. .----. .---. .------. .-----. >> in: | | | | | | | | | | >> ----' '------' '-------' '----' '-----' '--- >> >> clock: * * * * * * * * * * >> >> .-----. .-----. .-----. .-----. .-----. >> out: | | | | | | | | | | >> ----' '-----' '-----' '-----' '-----' '- >> >> Do you see some information being lost here? > > Phase?Or duration, or whatever. I think my point that you can't reconstruct the input from the output is made, however. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com