On Mon, 06 Feb 2012 10:41:41 -0500, Jerry Avins wrote:> On 2/6/2012 8:37 AM, Brian Willoughby wrote: > > ... > >> Thanks, guys. I may not have been looking at my analog scope closely >> enough to see a 10% drop from 5 Vpp. All the same, I do calculate >> 20*log(a) by habit. >> >> >> Also, thanks to Tim Wescott for pointing out the aliased energy. >> Ideally, there shouldn't be any aliased energy in a 'pure' sinusoid, >> but data is typically less than ideal. > > There might not be any 10% droop. The staircase adds harmonics (not > aliases!) so we don't know what the peak will be without calculation. > The 4 dB applies to the fundamental only, not the overall waveform after > the S&H. Put differently, it's what to expect after the reconstruction > filter that you don't have.Actually the staircase _does_ add aliases. If you happen to hit the DAC with a signal that has an integer number of steps in each cycle of the sine wave then all of those aliases fall onto integer multiples of the fundamental frequency and they _appear_ to be harmonics (well, maybe they _become_ aliases depending on how you hold your mouth) -- but imagine the case where the signal doesn't have an integer number of steps (imagine, for instance, a signal with a frequency of one radian/sample). In that case the fact that there is aliasing would become apparent. -- My liberal friends think I'm a conservative kook. My conservative friends think I'm a liberal kook. Why am I not happy that they have found common ground? Tim Wescott, Communications, Control, Circuits & Software http://www.wescottdesign.com
Spectrum compensation for zero-order hold DAC
Started by ●February 3, 2012
Reply by ●February 6, 20122012-02-06
Reply by ●February 6, 20122012-02-06
On 2/6/12 4:09 PM, glen herrmannsfeldt wrote:> Tim Wescott<tim@seemywebsite.com> wrote: > > (snip) >> There's really a singularity right at Nyquist.uh, isn't it at Fs (twice Nyquist) and multiples of that? aren't we talking about H(j*2*pi*f) = e^(-j*2*pi*f*T/2) * sin(pi*f*T)/(pi*f*T) this goes to zero when sin(pi*f*T) = 0 except when at f=0. this happens at f = 1/T = Fs = 2*Nyquist and multiples thereof. if the OP wanted to compensate for this with an analog filter after the DAC with ZOH properties (modern oversampling DACs don't do that, at least not at Fs), he could build some highly resonant analog filters with a Sallen-Key or something that puts poles very close to the j*omega axis at multiples of +/- j*2*pi*Fs (with a tiny and negative real part). Two pairs of poles, at s = -sigma +/- j*2*pi*Fs and s = -sigma +/- j*4*pi*Fs will flatten out that frequency response below Fs/2 pretty good. it's an icky way to do it.>> In the limit, as the >> sampling rate goes toward Nyquist and the observation time goes to >> infinity, the spectral component of the 'boxcar filtered' sine wave will, >> indeed, be about 4dB down.of course. it has to be.>> But _right at_ Nyquist reason breaks down a bit: you either have to claim >> that the _expected_ value of the wave, taken over a phase whose >> probability distribution is uniform from -pi to +pi, is 4dB down, or you >> have to say "ooh, Nyquist, bad juju" and refuse to do the calculation >> _right there_.oh, i see what you mean. that's because the sampling theorem says that reconstruction breaks down for components exactly at Nyquist. you cannot know both the phase and the amplitude of a sinusoid exactly at Nyquist. so there is a funny sorta alias where you think you sampled it with some phase and amplitude and it comes out at a different phase and amplitude if the sinusoid is sampled at the zero-crossings you have no idea what the amplitude could have been and it's indistinguishable from the alias of nothing there at all.> If you get that close, you should consider that Nyquist only works > for signals defined for all time (infinite time) or periodic.for me, i don't think you can do it at Nyquist at all. but if it's just below Nyquist, you can if you have long enough window.> > Most of the time, it is "close enough". > >> If you get away from Nyquist the least bit, and average your results over >> at least one cycle of the beat frequency between signal frequency - >> Nyquist and Nyquist - signal frequency, then you'll find that you do, >> indeed, approach the 4dB down for the signal _at_ the signal frequency.yup. *on average* in some sense of word. of course, at one point in the beating, the amplitude at that sole frequency is even higher than 0 dB. but if you include all of the phases of the beating, it should be down 3.92 dB. -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."
Reply by ●February 6, 20122012-02-06
On 2/6/2012 5:56 PM, Tim Wescott wrote:> On Mon, 06 Feb 2012 10:41:41 -0500, Jerry Avins wrote: > >> On 2/6/2012 8:37 AM, Brian Willoughby wrote: >> >> ... >> >>> Thanks, guys. I may not have been looking at my analog scope closely >>> enough to see a 10% drop from 5 Vpp. All the same, I do calculate >>> 20*log(a) by habit. >>> >>> >>> Also, thanks to Tim Wescott for pointing out the aliased energy. >>> Ideally, there shouldn't be any aliased energy in a 'pure' sinusoid, >>> but data is typically less than ideal. >> >> There might not be any 10% droop. The staircase adds harmonics (not >> aliases!) so we don't know what the peak will be without calculation. >> The 4 dB applies to the fundamental only, not the overall waveform after >> the S&H. Put differently, it's what to expect after the reconstruction >> filter that you don't have. > > Actually the staircase _does_ add aliases. If you happen to hit the DAC > with a signal that has an integer number of steps in each cycle of the > sine wave then all of those aliases fall onto integer multiples of the > fundamental frequency and they _appear_ to be harmonics (well, maybe they > _become_ aliases depending on how you hold your mouth) -- but imagine the > case where the signal doesn't have an integer number of steps (imagine, > for instance, a signal with a frequency of one radian/sample). In that > case the fact that there is aliasing would become apparent.No. If a reconstruction filter can take it out, it's not an alias. Do you claim that it isn't possible to reconstruct a sampled band-limited signal? Jerry -- Engineering is the art of making what you want from things you can get. ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Reply by ●February 6, 20122012-02-06
On Mon, 06 Feb 2012 19:04:38 -0500, Jerry Avins wrote:> On 2/6/2012 5:56 PM, Tim Wescott wrote: >> On Mon, 06 Feb 2012 10:41:41 -0500, Jerry Avins wrote: >> >>> On 2/6/2012 8:37 AM, Brian Willoughby wrote: >>> >>> ... >>> >>>> Thanks, guys. I may not have been looking at my analog scope closely >>>> enough to see a 10% drop from 5 Vpp. All the same, I do calculate >>>> 20*log(a) by habit. >>>> >>>> >>>> Also, thanks to Tim Wescott for pointing out the aliased energy. >>>> Ideally, there shouldn't be any aliased energy in a 'pure' sinusoid, >>>> but data is typically less than ideal. >>> >>> There might not be any 10% droop. The staircase adds harmonics (not >>> aliases!) so we don't know what the peak will be without calculation. >>> The 4 dB applies to the fundamental only, not the overall waveform >>> after the S&H. Put differently, it's what to expect after the >>> reconstruction filter that you don't have. >> >> Actually the staircase _does_ add aliases. If you happen to hit the >> DAC with a signal that has an integer number of steps in each cycle of >> the sine wave then all of those aliases fall onto integer multiples of >> the fundamental frequency and they _appear_ to be harmonics (well, >> maybe they _become_ aliases depending on how you hold your mouth) -- >> but imagine the case where the signal doesn't have an integer number of >> steps (imagine, for instance, a signal with a frequency of one >> radian/sample). In that case the fact that there is aliasing would >> become apparent. > > No. If a reconstruction filter can take it out, it's not an alias. Do > you claim that it isn't possible to reconstruct a sampled band-limited > signal?You are defining aliasing differently than I do, and, I suspect, differently from the way that most of the world does. By my definition, a signal which appears at a different frequency from that at which it was sampled is an alias. The goal of the system designer is to make sure that any unwanted aliases fall in a spectrum that is disjoint from the spectrum of the wanted signal (or alias), so that a reconstruction filter can, indeed, take it out. In fact, Wikipedia's definition matches mine: "In signal processing and related disciplines, aliasing refers to an effect that causes different signals to become indistinguishable (or aliases of one another) when sampled." It is immaterial to me if a 2kHz signal is an alias of a 3kHz signal, if all I care about are signals from DC to 1kHz: I'll filter out the 2kHz signal and the 3kHz signal to boot. It's much the same as if I ask your name and you tell me "Ralph" -- if I'm looking for a guy named Bob, I don't care if your name is Jerry, Ralph, or Murgatroyd, as long as it isn't Bob. -- Tim Wescott Control system and signal processing consulting www.wescottdesign.com
Reply by ●February 6, 20122012-02-06
On Mon, 06 Feb 2012 18:15:43 -0500, robert bristow-johnson wrote:> On 2/6/12 4:09 PM, glen herrmannsfeldt wrote: >> Tim Wescott<tim@seemywebsite.com> wrote: >> >> (snip) >>> There's really a singularity right at Nyquist. > > uh, isn't it at Fs (twice Nyquist) and multiples of that? aren't we > talking about > > H(j*2*pi*f) = e^(-j*2*pi*f*T/2) * sin(pi*f*T)/(pi*f*T) > > this goes to zero when sin(pi*f*T) = 0 except when at f=0. > > this happens at f = 1/T = Fs = 2*Nyquist and multiples thereof. >No -- I'm talking about Nyquist. Sample at Fs. Sample a signal x(t) = cos(th + pi * Fs * t), whose frequency is Fs/2 (Nyquist). The samples that you get will be x(n) = cos(th + pi * n), or cos(th) * [1, -1, 1, -1, ...] If th = m*pi (m is integer), then the signal will have amplitude 1; if th = pi/2 + m*pi, then the signal will be identically zero. If th is somewhere in between, then -- well -- things will be somewhere in between. (With all due attention paid to -pi/2 < th < 0, and all other possible values of th). What the OP was overlooking is that _in the limit_ as f approaches Fs/2 the signal in question has an amplitude _at f_ of 2/pi (I think that's what it was, at least), as predicted. But the closer that f gets to Fs/2 the longer you have to look to see the average, etc. -- Tim Wescott Control system and signal processing consulting www.wescottdesign.com
Reply by ●February 6, 20122012-02-06
On Mon, 06 Feb 2012 19:24:34 -0600, Tim Wescott <tim@seemywebsite.please> wrote:>On Mon, 06 Feb 2012 19:04:38 -0500, Jerry Avins wrote: > >> On 2/6/2012 5:56 PM, Tim Wescott wrote: >>> On Mon, 06 Feb 2012 10:41:41 -0500, Jerry Avins wrote: >>> >>>> On 2/6/2012 8:37 AM, Brian Willoughby wrote: >>>> >>>> ... >>>> >>>>> Thanks, guys. I may not have been looking at my analog scope closely >>>>> enough to see a 10% drop from 5 Vpp. All the same, I do calculate >>>>> 20*log(a) by habit. >>>>> >>>>> >>>>> Also, thanks to Tim Wescott for pointing out the aliased energy. >>>>> Ideally, there shouldn't be any aliased energy in a 'pure' sinusoid, >>>>> but data is typically less than ideal. >>>> >>>> There might not be any 10% droop. The staircase adds harmonics (not >>>> aliases!) so we don't know what the peak will be without calculation. >>>> The 4 dB applies to the fundamental only, not the overall waveform >>>> after the S&H. Put differently, it's what to expect after the >>>> reconstruction filter that you don't have. >>> >>> Actually the staircase _does_ add aliases. If you happen to hit the >>> DAC with a signal that has an integer number of steps in each cycle of >>> the sine wave then all of those aliases fall onto integer multiples of >>> the fundamental frequency and they _appear_ to be harmonics (well, >>> maybe they _become_ aliases depending on how you hold your mouth) -- >>> but imagine the case where the signal doesn't have an integer number of >>> steps (imagine, for instance, a signal with a frequency of one >>> radian/sample). In that case the fact that there is aliasing would >>> become apparent. >> >> No. If a reconstruction filter can take it out, it's not an alias. Do >> you claim that it isn't possible to reconstruct a sampled band-limited >> signal? > >You are defining aliasing differently than I do, and, I suspect, >differently from the way that most of the world does. > >By my definition, a signal which appears at a different frequency from >that at which it was sampled is an alias. The goal of the system >designer is to make sure that any unwanted aliases fall in a spectrum >that is disjoint from the spectrum of the wanted signal (or alias), so >that a reconstruction filter can, indeed, take it out. > >In fact, Wikipedia's definition matches mine: "In signal processing and >related disciplines, aliasing refers to an effect that causes different >signals to become indistinguishable (or aliases of one another) when >sampled." It is immaterial to me if a 2kHz signal is an alias of a 3kHz >signal, if all I care about are signals from DC to 1kHz: I'll filter out >the 2kHz signal and the 3kHz signal to boot. It's much the same as if I >ask your name and you tell me "Ralph" -- if I'm looking for a guy named >Bob, I don't care if your name is Jerry, Ralph, or Murgatroyd, as long as >it isn't Bob. > >-- >Tim Wescott >Control system and signal processing consulting >www.wescottdesign.comJerry got me with the same thing, and I generally and casually think of it the same as you, but I do think "alias" is a more proper term when applied to sampling than it is for reconstruction. In reconstruction I think "image" is a little more often used to distinguish the signals outside of the normal <fs/2 support region of the desired signal. So I think many people think of "aliasing" as only happening below fs/2 in sampled signals when energy from >fs/2 folds down into <fs/2. In reconstruction a signal from <fs/2 folds up to the N*>fs/2 regions to make an "image". It's a distinction, but I do use the term "alias" to refer to both cases from time to time (as I did here yesterday), but I think "image" is a better term for the reconstruction case just to help make the distinction more clear. It's yet another of those semantic things that so often gets us in this industry. Eric Jacobsen Anchor Hill Communications www.anchorhill.com
Reply by ●February 7, 20122012-02-07
On 2/6/12 9:25 PM, Eric Jacobsen wrote:> On Mon, 06 Feb 2012 19:24:34 -0600, Tim Wescott > <tim@seemywebsite.please> wrote: > >> On Mon, 06 Feb 2012 19:04:38 -0500, Jerry Avins wrote: >> >>> On 2/6/2012 5:56 PM, Tim Wescott wrote:...>>>> >>>> Actually the staircase _does_ add aliases....>>> >>> No. If a reconstruction filter can take it out, it's not an alias. Do >>> you claim that it isn't possible to reconstruct a sampled band-limited >>> signal? >> >> You are defining aliasing differently than I do, and, I suspect, >> differently from the way that most of the world does. >> >> By my definition, a signal which appears at a different frequency from >> that at which it was sampled is an alias....> Jerry got me with the same thing,and Jerry's right.> and I generally and casually think > of it the same as you, but I do think "alias" is a more proper term > when applied to sampling than it is for reconstruction. In > reconstruction I think "image" is a little more often used to > distinguish the signals outside of the normal<fs/2 support region of > the desired signal. > > So I think many people think of "aliasing" as only happening below > fs/2 in sampled signals when energy from>fs/2 folds down into<fs/2.yes, that's what an alias is. it is component that originally was as some frequency, f, that gets folded back to Fs-f and is masquerading as if it had been at Fs-f all of the time. the anti-aliasing filters are the ones that go before the A/D converter. what comes after the D/A converter are anti-imaging filters. -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."
Reply by ●February 7, 20122012-02-07
On 2/6/12 8:36 PM, Tim Wescott wrote:> On Mon, 06 Feb 2012 18:15:43 -0500, robert bristow-johnson wrote: > >> On 2/6/12 4:09 PM, glen herrmannsfeldt wrote: >>> Tim Wescott<tim@seemywebsite.com> wrote: >>> >>> (snip) >>>> There's really a singularity right at Nyquist. >> >> uh, isn't it at Fs (twice Nyquist) and multiples of that? aren't we >> talking about >> >> H(j*2*pi*f) = e^(-j*2*pi*f*T/2) * sin(pi*f*T)/(pi*f*T) >> >> this goes to zero when sin(pi*f*T) = 0 except when at f=0. >> >> this happens at f = 1/T = Fs = 2*Nyquist and multiples thereof. >> > No -- I'm talking about Nyquist.but that's not really what a singularity is. i'm thinking singularities are zeros or poles. or a pole canceled by a zero.> > Sample at Fs. Sample a signal x(t) = cos(th + pi * Fs * t), whose > frequency is Fs/2 (Nyquist). The samples that you get will be > > x(n) = cos(th + pi * n), or > > cos(th) * [1, -1, 1, -1, ...] > > If th = m*pi (m is integer), then the signal will have amplitude 1; if th > = pi/2 + m*pi, then the signal will be identically zero.and that is the result of aliasing. it's what i said. if x[n] = A * (-1)^n that could be x[n] = A * cos(pi*n) or it could be x[n] = A/cos(theta) * cos(pi*n + theta) for any theta. if you're defining that as a function of theta, you do get a singularity at |theta| = pi/2 and indeed, you cannot reconstruct amplitude even if you knew the phase. it's like multiplying by zero destroys information. you cannot get it back by dividing by zero. -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."
Reply by ●February 7, 20122012-02-07
On 2/3/12 6:05 PM, HardySpicer wrote:> On Feb 4, 10:31 am, Jerry Avins<j...@ieee.org> wrote: >> On 2/3/2012 7:44 AM, Brian Willoughby wrote: >> >>> I just came across a concept that doesn't completely make sense to me, >>> and I am hoping that the group can help me to understand more. >> >> [confusion deleted (if only!)] >> >> The root of your confusion is a bad assumption early on. The >> sample-and-hold does affect the response below Nyquist. A sample and >> hold has no effect at DC, and puts out only DC when the input signal is >> at the sample rate. In between it gently rolls off along a sin(x)/x >> curve. (x = pi at the sample rate.) At the Nyquist rate, the output (of >> the fundamental) sin(pi/2)/(pi/2), or about .637. that's roughly -4 dB. > > You mean zero-order hold - not sample and hold...i think he does, but an analog signal sampled with an ideal dirac-comb followed by a ZOH (which is an LTI system with an impulse response and a frequency response), gets you the same electrical signal as the same analog signal being sampled and held with an S/H. -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."
Reply by ●February 7, 20122012-02-07
BTW, the catch with the Nyquist limit is, you'll need to decide whether you consider it a positive or a negative frequency. For a _complex-valued_ time domain signal (asymmetric spectrum), for example with a pair of DACs in quadrature, it's fairly intuitive. I usually give it a "minus" sign, because it makes juggling with even-sized FFTs easier (since the 0 Hz bin counts as "non-negative" frequency in my book). Used consistently, there won't be any error at all - my simulations usually stick close to numerical precision. Now with a _real-valued_ time domain signal, for a single DAC, things get messy and some oversampling becomes necessary.






