DSPRelated.com
Forums

Basic Sampling Theory Question

Started by old_ee August 17, 2015
On Friday, August 21, 2015 at 9:30:47 AM UTC-4, kaz wrote:
> >Hi, > > > > If I have a sine wave with period T. The sampling theory says I can > >recover it by sampling at T/2. That is two points, barely enough to draw > a > >straight line. > > > > What am I missing here? > > > > > >--------------------------------------- > >Posted through http://www.DSPRelated.com > > There is plenty of response to your post. I don't see any issue here. > if you are in digital domain and have two regular values into a DAC device > then you can construct the sine wave (after filtering images). > If you are in analogue domain you can sample a sine waveform by two > samples per period, best SNR occurs if you hit the peaks/troughs and zero > occurs if you hit at zero crossings. anywhere in between can be > interpolated back for better snr. > > so why two points mean a straight line? > > Kaz > --------------------------------------- > Posted through http://www.DSPRelated.com
This is not correct. If you sample at 2 samples per period for a sinusoidal waveform, the values are of the form -V, +V, for V>=0. You cannot know the amplitude of the sinusoid since the samples could have come from a sinusoid with ANY amplitude >= V. If V=0, you do not even know of a sinusoid is present from the samples. In general you do not know the phase. The exception is when V=0, if you know a sinusoid is actually present (which you can't tell from the samples). Dirk
<bellda2005@gmail.com> wrote:

>On Friday, August 21, 2015 at 9:30:47 AM UTC-4, kaz wrote:
>> If you are in analogue domain you can sample a sine waveform by two >> samples per period, best SNR occurs if you hit the peaks/troughs and zero >> occurs if you hit at zero crossings. anywhere in between can be >> interpolated back for better snr.
>This is not correct. If you sample at 2 samples per period for a >sinusoidal waveform, the values are of the form -V, +V, for V>=0. You >cannot know the amplitude of the sinusoid since the samples could have >come from a sinusoid with ANY amplitude >= V.
>If V=0, you do not even know of a sinusoid is present from the samples.
>In general you do not know the phase. The exception is when V=0, if you >know a sinusoid is actually present (which you can't tell from the >samples).
This is why you need (at least slightly) more than two samples per period. Steve
On Friday, August 21, 2015 at 7:15:00 PM UTC+12, Evgeny Filatov wrote:
> On 19.08.2015 23:51, Eric Jacobsen wrote: > > On Wed, 19 Aug 2015 22:52:52 +0300, Evgeny Filatov > > <e.v.filatov@ieee.org> wrote: > > > >> On 18.08.2015 21:29, gyansorova@gmail.com wrote: > >> (snip) > >> > >>> Just a small correction, sampling theory was not due to Nyquist and Shannon but Whittaker and a Russian gentleman. Shannon just put it in an engineering framework. > >>> > >> > >> That gentleman's name is Kotelnikov. > >> > >> http://en.wikipedia.org/wiki/Vladimir_Kotelnikov > >> > >> Evgeny. > >> > > > > It's sad that the cold war kept a lot of science and engineering > > developments of the two sides separated for so long. I hope that > > doesn't ever happen again. > > > > > > Eric Jacobsen > > Anchor Hill Communications > > http://www.anchorhill.com > > > > Actually one of the reasons I like this place is that it's apolitical. > > A decade ago, when I was a college student, once we've got the attention > of a "telephone terrorist". There was a phone call to the police > (falsely) claiming there's a bomb somewhere in the college. All classes > were cancelled. Except for, guess what? A lecture in calculus, which > went on like if nothing extraordinary had happened. > > Imho, that tells something about the relative importance of math and > politics. > > Evgeny.
err yes ,it means the maths teacher was a right pratt with no concern for safety.
On Fri, 21 Aug 2015 22:43:54 +0000, Steve Pope wrote:

> <bellda2005@gmail.com> wrote: > >>On Friday, August 21, 2015 at 9:30:47 AM UTC-4, kaz wrote: > >>> If you are in analogue domain you can sample a sine waveform by two >>> samples per period, best SNR occurs if you hit the peaks/troughs and >>> zero occurs if you hit at zero crossings. anywhere in between can be >>> interpolated back for better snr. > >>This is not correct. If you sample at 2 samples per period for a >>sinusoidal waveform, the values are of the form -V, +V, for V>=0. You >>cannot know the amplitude of the sinusoid since the samples could have >>come from a sinusoid with ANY amplitude >= V. > >>If V=0, you do not even know of a sinusoid is present from the samples. > >>In general you do not know the phase. The exception is when V=0, if you >>know a sinusoid is actually present (which you can't tell from the >>samples). > > This is why you need (at least slightly) more than two samples per > period.
And how much that "at least slightly" is depends on a lot of other factors. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com
<gyansorova@gmail.com> wrote:

>On Friday, August 21, 2015 at 7:15:00 PM UTC+12, Evgeny Filatov wrote:
>> A decade ago, when I was a college student, once we've got the attention >> of a "telephone terrorist". There was a phone call to the police >> (falsely) claiming there's a bomb somewhere in the college. All classes >> were cancelled. Except for, guess what? A lecture in calculus, which >> went on like if nothing extraordinary had happened.
>> Imho, that tells something about the relative importance of math and >> politics.
>err yes ,it means the maths teacher was a right pratt with no concern >for safety.
I tend to agree. I was in an engineering building at UC Berkeley when one of the Unabomber's bombs went off. If one had a chance to evacuate, even if 98% of those are false warnings, then that is a good idea. Steve
Tim Wescott <seemywebsite@myfooter.really> wrote:
> On Fri, 21 Aug 2015 22:43:54 +0000, Steve Pope wrote:
(snip, someone wrote regarding sampling)
>>>In general you do not know the phase. The exception is when V=0, if you >>>know a sinusoid is actually present (which you can't tell from the >>>samples).
>> This is why you need (at least slightly) more than two samples per >> period.
> And how much that "at least slightly" is depends on a lot of other > factors.
For real Nyquist sampling, you need an infinite number of points (or periodic boundary conditions), in which case slightly is very slight. But in reality, we don't have an infinite number of points. -- glen
On Sat, 22 Aug 2015 05:00:37 +0000, glen herrmannsfeldt wrote:

> Tim Wescott <seemywebsite@myfooter.really> wrote: >> On Fri, 21 Aug 2015 22:43:54 +0000, Steve Pope wrote: > > (snip, someone wrote regarding sampling) > >>>>In general you do not know the phase. The exception is when V=0, if >>>>you know a sinusoid is actually present (which you can't tell from the >>>>samples). > >>> This is why you need (at least slightly) more than two samples per >>> period. > >> And how much that "at least slightly" is depends on a lot of other >> factors. > > For real Nyquist sampling, you need an infinite number of points (or > periodic boundary conditions), in which case slightly is very slight. > > But in reality, we don't have an infinite number of points. > > -- glen
For signal processing I'm pretty sure that the two biggest issues are how much fewer than an infinite amount of points you have, and how much phase distortion you can stand (they're probably related). For real-time control or any other application where actual delay matters rather than just relative delay, the sampling rate generally needs to be much higher than any "Nyquist" frequency would indicate. -- www.wescottdesign.com
On 8/24/15 1:33 AM, Tim Wescott wrote:
> On Sat, 22 Aug 2015 05:00:37 +0000, glen herrmannsfeldt wrote: > >> Tim Wescott<seemywebsite@myfooter.really> wrote: >>> On Fri, 21 Aug 2015 22:43:54 +0000, Steve Pope wrote: >> >> (snip, someone wrote regarding sampling) >> >>>>> In general you do not know the phase. The exception is when V=0, if >>>>> you know a sinusoid is actually present (which you can't tell from the >>>>> samples). >> >>>> This is why you need (at least slightly) more than two samples per >>>> period. >> >>> And how much that "at least slightly" is depends on a lot of other >>> factors. >> >> For real Nyquist sampling, you need an infinite number of points (or >> periodic boundary conditions), in which case slightly is very slight. >> >> But in reality, we don't have an infinite number of points. >> > > For signal processing I'm pretty sure that the two biggest issues are how > much fewer than an infinite amount of points you have,
i thought that modeling zero-padding a brick-wall LPF FIR definitively models the fewer. (then in our analysis we can pretend we have an infinite number of points when we Fourier transform stuff.)
> and how much phase distortion you can stand (they're probably related).
dunno for sure about what is "phase distortion", but for me the tradeoff is the number of coefs in the polyphase FIR vs how much aliasing distortion you can stand.
> For real-time control or any other application where actual delay matters > rather than just relative delay, the sampling rate generally needs to be > much higher than any "Nyquist" frequency would indicate.
and usually it is, ain't it? i wonder how many people use a soundcard to do a controller for a real-time control app? just wondering. sometimes people use technology for a different application field to do stuff. like audio people using a graphic accelerator to do massively computational real-time audio stuff. (i can sorta see it for reverberation or maybe de-reverberation.) -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."
old_ee <107864@DSPRelated> wrote: 

>If I have a sine wave with period T. The sampling theory says I can >recover it by sampling at T/2. That is two points, barely enough to draw a >straight line.
>What am I missing here?
You're not missing anything - the issue has been noted before. For instance, from "Principles of Communication Systems" by Taub and Schilling, McGraw-Hill, 1971, pps. 160-161: "An interesting special case is the sampling of a sinusoidal signal having the frequency Fm (i.e.: fs/2). Here, all the signal power is concentrated precisely at the cut-off frequency ... and there is some ambiguity about whether the signal frequency is inside or outside the bandwidth. To remove this ambiguity, we require fs > 2Fm rather than that fs >= 2Fm. To see that this condition is necessary, assume that fs = 2Fm but that an initial sample is taken at the moment the sinusoid passes through zero. Then all successive samples will also be zero. This situation is avoided by requiring fs > 2Fm." As noted by others, what you get at the Nyquist bin (for even N) depends on when you start sampling. All other ambiguities/conceptual problems can be resolved by waving ones hands and drinking the Kool-Aid.
On Mon, 24 Aug 2015 15:53:49 -0400, robert bristow-johnson
<rbj@audioimagination.com> wrote:

>i wonder how many people use a soundcard to do a controller for a >real-time control app? > >just wondering. sometimes people use technology for a different >application field to do stuff. like audio people using a graphic >accelerator to do massively computational real-time audio stuff. (i can >sorta see it for reverberation or maybe de-reverberation.)
One big limitation with sound cards as controllers is that they are all AC coupled. (The ones that claim "DC coupled" really mean they are using servo-controlled stages that take the input capacitor out of the signal path, but it's still there in the feedback integrator giving a high-pass response.) That fact means custom modifications or extra custom-built hardware are needed to get DC into and out of the card, which limits a lot of the interesting controller applications. (I have a couple of DC input circuits at <http://www.daqarta.com/dw_ggmm.htm>, and DC pulse output circuits at <http://www.daqarta.com/dw_gg0o.htm>.) Best regards, Bob Masta DAQARTA v8.00 Data AcQuisition And Real-Time Analysis www.daqarta.com Scope, Spectrum, Spectrogram, Sound Level Meter Frequency Counter, Pitch Track, Pitch-to-MIDI FREE 8-channel Signal Generator, DaqMusiq generator Science with your sound card!