DSPRelated.com
Forums
Online · Live + on demand
February 9-11, 2027
Price goes up Jan 1: register now to lock in today's rate
Register Now →

reconciling conv in time domain = multiplication in freq domain

Started by all4dsp ●September 16, 2010
On Mon, 20 Sep 2010 18:10:57 -0700 (PDT), dvsarwate
<dvsarwate@gmail.com> wrote:

>On Sep 20, 4:12&#4294967295;pm, Rick Lyons <R.Lyons@_BOGUS_ieee.org> averred: > >> >> For example, the period (time-duration) of exactly one cycle >> an analog 50 Hz sinewave is equal to 20 millisecond. &#4294967295;However, >> the time-duration of exactly one cycle of a discrete 1 Hz sinewave, >> sampled at 1000 samples/second, is equal to 19 milliseconds. >> Interesting, huh? >> > > >Wow! If Rick says so, it must be true; and now I >am going to spend a sleepless night trying to figure >out how the one-second duration of one period of >a 1 Hz wave got squeezed into just 19 samples >out of 1000. It is not even a harmonic relation... > >--Dilip Sarwate
Hi Dilip, Oops. That's what I get for not reviewing what I wrote. What I meant to write was: &#4294967295; "However, the time-duration of exactly one cycle of a discrete 50 Hz sinewave, sampled at 1000 samples/second, is equal to 19 milliseconds." Sheece! Sorry for the confusion. [-Rick-]
On Sep 21, 1:55&#4294967295;pm, Rick Lyons <R.Lyons@_BOGUS_ieee.org> wrote:

> > What I meant to write was: &#4294967295; > > &#4294967295; "However, the time-duration of exactly one cycle > &#4294967295; &#4294967295;of a discrete 50 Hz sinewave, sampled at 1000 > &#4294967295; &#4294967295;samples/second, is equal to 19 milliseconds." >
Rick: I respectfully beg to differ. A 50Hz sine wave sampled at 1000 samples/second has 20 samples per period, say x[1], x[2], .... , x[20], and while the time duration between x[1] and x[20] is only 19 milliseconds, I do not think it is right to say that the duration of one cycle is 19 milliseconds. For a discrete periodic sequence with period N, x[1] equals x[1+N], and the time between two identical sample values is thus NT, (20 milliseconds in our case), and not (N-1)T (the time elapsed between x[1] and x[N], the N samples in one period). Reflect that your definition would seem to say that M periods of the 50 Hz wave sampled at 1000 samples/second would have time duration M*19 milliseconds, whereas defining the time duration of a period as NT would be more reasonable. The reason for nitpicking is that all these responses are directed to the OP all4dsp who is self-admittedly a beginner. --Dilip Sarwate
On 9/21/2010 2:27 PM, dvsarwate wrote:
> On Sep 21, 1:55 pm, Rick Lyons<R.Lyons@_BOGUS_ieee.org> wrote: > >> >> What I meant to write was: >> >> "However, the time-duration of exactly one cycle >> of a discrete 50 Hz sinewave, sampled at 1000 >> samples/second, is equal to 19 milliseconds." >> > > > Rick: > > I respectfully beg to differ. A 50Hz sine wave > sampled at 1000 samples/second has 20 samples > per period, say x[1], x[2], .... , x[20], and while the > time duration between x[1] and x[20] is only 19 > milliseconds, I do not think it is right to say that the > duration of one cycle is 19 milliseconds. For a > discrete periodic sequence with period N, x[1] > equals x[1+N], and the time between two identical > sample values is thus NT, (20 milliseconds in our > case), and not (N-1)T (the time elapsed between > x[1] and x[N], the N samples in one period). > > Reflect that your definition would seem to say that > M periods of the 50 Hz wave sampled at 1000 > samples/second would have time duration M*19 > milliseconds, whereas defining the time duration > of a period as NT would be more reasonable. > The reason for nitpicking is that all these responses > are directed to the OP all4dsp who is self-admittedly > a beginner. > > --Dilip Sarwate > >
??? Am I missing something? I would have said this: A 50Hz sine wave has a period of 20msec. Sampling doesn't change that. Sampling at 1000Hz means the sample interval is 1msec. A period of the 50Hz sine wave above will cover 20 sampling periods. It may consist of 20 samples or 21 samples depending on how we define things. If our definition includes repetition of the end points then it has 21 samples. 0 through N=20 which is 21 samples. If our definition does not include repetition of the end points then it has 20 samples. 0 through 19 which is 20 samples. And, if there are multiple periods to be sampled then there are 20 samples per period neglecting the far end points one way or another. Now, if we are going to FFT a sequence using the sine frequency and sample rate from above and if we want an integral number M of cycles in the end result, then we would want an interval that is an integer number of cycles of the 50Hz less one sample, (an integral multiple of 20) less 1. So, we would not include the last sample in the interval (as we are going to assume that it repeats at that point ... is equal to the zeroeth sample). So, there will be: 20M intervals less one sample. 20M intervals plus the zeroeth sample is 20M+1 samples end to end; less 1 is 20M samples total. Fred
On Tue, 21 Sep 2010 14:27:32 -0700 (PDT), dvsarwate
<dvsarwate@gmail.com> wrote:

>On Sep 21, 1:55&#4294967295;pm, Rick Lyons <R.Lyons@_BOGUS_ieee.org> wrote: > >> >> What I meant to write was: &#4294967295; >> >> &#4294967295; "However, the time-duration of exactly one cycle >> &#4294967295; &#4294967295;of a discrete 50 Hz sinewave, sampled at 1000 >> &#4294967295; &#4294967295;samples/second, is equal to 19 milliseconds." >> > > >Rick:
Hi Dilip, Thoughtful posts, such as yours, are one of the main reasons I appreciate this Newsgroup so much.
>I respectfully beg to differ. A 50Hz sine wave >sampled at 1000 samples/second has 20 samples >per period, say x[1], x[2], .... , x[20], and while the >time duration between x[1] and x[20] is only 19 >milliseconds, I do not think it is right to say that the >duration of one cycle is 19 milliseconds. For a >discrete periodic sequence with period N, x[1] >equals x[1+N], and the time between two identical >sample values is thus NT, (20 milliseconds in our >case), and not (N-1)T (the time elapsed between >x[1] and x[N], the N samples in one period).
My main point was that the time duration of a 20-point sequence is 19*T, where T is the time between samples. For example, the duration, by my definition, of the following five-sample sequence is 4*T: * * * * * ------------------- For me, the word "duration" is defined as the time difference between the first and last samples. Is that a "valid" definition? I thought it was. Now you, Fred Marshall, bring up the notion of multiple cycles of a discrete sinusoid. And you introduced the word "period", and seem to define it as the time difference between to identical samples (of equal phase within a cycle) of a multicycle sinusoid. That sure seems right to me. For our 50 Hz discrete sinusoid example then, the period would then be 20*T = 20 milliseconds. For me, your and Fred's comments invite meditation. I'm wondering: Does this mean that the "duration" and "period" of one cycle of a discrete sinewave are two different things? Ha ha. I'll have to think more about the words we use.
>Reflect that your definition would seem to say that >M periods of the 50 Hz wave sampled at 1000 >samples/second would have time duration M*19 >milliseconds, whereas defining the time duration >of a period as NT would be more reasonable.
Actually, by my definition of "duration", the duration of M cycles of our 50 Hz discrete sinusoid would be 20*M-1 milliseconds. For example, the duration (the time difference between the first and last samples) of M = 2 cycles of our discrete 50 Hz sinewave would be 39 milliseconds. These discussions are both interesting and fun.
>The reason for nitpicking is that all these responses >are directed to the OP all4dsp who is self-admittedly >a beginner.
I could NOT agree more with that sentiment. See Ya', [-Rick-]
On Tue, 21 Sep 2010 15:52:23 -0700, Fred Marshall
<fmarshall_xremove_the_xs@xacm.org> wrote:

>On 9/21/2010 2:27 PM, dvsarwate wrote: >> On Sep 21, 1:55 pm, Rick Lyons<R.Lyons@_BOGUS_ieee.org> wrote: >> >>> >>> What I meant to write was: >>> >>> "However, the time-duration of exactly one cycle >>> of a discrete 50 Hz sinewave, sampled at 1000 >>> samples/second, is equal to 19 milliseconds." >>> >> >> >> Rick: >> >> I respectfully beg to differ. A 50Hz sine wave >> sampled at 1000 samples/second has 20 samples >> per period, say x[1], x[2], .... , x[20], and while the >> time duration between x[1] and x[20] is only 19 >> milliseconds, I do not think it is right to say that the >> duration of one cycle is 19 milliseconds. For a >> discrete periodic sequence with period N, x[1] >> equals x[1+N], and the time between two identical >> sample values is thus NT, (20 milliseconds in our >> case), and not (N-1)T (the time elapsed between >> x[1] and x[N], the N samples in one period). >> >> Reflect that your definition would seem to say that >> M periods of the 50 Hz wave sampled at 1000 >> samples/second would have time duration M*19 >> milliseconds, whereas defining the time duration >> of a period as NT would be more reasonable. >> The reason for nitpicking is that all these responses >> are directed to the OP all4dsp who is self-admittedly >> a beginner. >> >> --Dilip Sarwate >>
>???
Hi Fred,
>Am I missing something? > >I would have said this: > >A 50Hz sine wave has a period of 20msec. >Sampling doesn't change that. > >Sampling at 1000Hz means the sample interval is 1msec. >A period of the 50Hz sine wave above will cover 20 sampling periods. >It may consist of 20 samples or 21 samples depending on how we define >things. > >If our definition includes repetition of the end points then it has 21 >samples. 0 through N=20 which is 21 samples. >If our definition does not include repetition of the end points then it >has 20 samples. 0 through 19 which is 20 samples. >And, if there are multiple periods to be sampled then there are 20 >samples per period neglecting the far end points one way or another. > >Now, if we are going to FFT a sequence using the sine frequency and >sample rate from above and if we want an integral number M of cycles in >the end result, then we would want an interval that is an integer number >of cycles of the 50Hz less one sample, (an integral multiple of 20) less 1. >So, we would not include the last sample in the interval (as we are >going to assume that it repeats at that point ... is equal to the >zeroeth sample). >So, there will be: >20M intervals less one sample. >20M intervals plus the zeroeth sample is 20M+1 samples end to end; less >1 is 20M samples total.
Thanks for joining in on this thread. Your comments are always of value to me. (As an aside Fred, I'll say what many people think. The product of your knowledge times your willingness to help is a VERY large value. Too bad we didn't have the chance to meet you at the 2010 COMP.DSP Conference last April.) Fred, please have a look at my reply to Dilip. See Ya', [-Rick-]
On Sep 21, 6:26&#4294967295;pm, Rick Lyons <R.Lyons@_BOGUS_ieee.org> wrote:
> > ... > For me, your and Fred's comments invite meditation. >...
Rick During your meditations you might look at the first two pages of the fred harris IEEE Proceedings paper for an example of a treatment of samples and periods (with graphics) On the Use of Windows for Harmonic Analysis with the Discrete. Fourier Transform. Proceedings of the IEEE, vol. 66, No. 1, January 1978. http://utdallas.edu/~cpb021000/EE%204361/Great%20DSP%20Papers/Harris%20on%20Windows.pdf Dale B. Dalrymple http://dbdimages.com
On 22/09/2010 02:26, Rick Lyons wrote:
..
> My main point was that the time duration of > a 20-point sequence is 19*T, where T is the time > between samples. For example, the duration, by my > definition, of the following five-sample sequence > is 4*T: > > * > * > * * * > > ------------------- > > For me, the word "duration" is defined as the time > difference between the first and last samples. > Is that a "valid" definition? I thought it was.
It seems to me, the ascii art may be a little misleading. T is not the position so much as the distance (duration) between points. By your argument, if we redraw the points like this: * (*) * * * * ^ ^ a b the repeat of the cycle is at (a) rather than at (b). The duration after the final point must be accounted for, so the total is 0...b (or 5*T), not 0...a. Richard Dobson
On Wed, 22 Sep 2010 09:56:34 +0100, Richard Dobson
<richarddobson@blueyonder.co.uk> wrote:

>On 22/09/2010 02:26, Rick Lyons wrote: >.. >> My main point was that the time duration of >> a 20-point sequence is 19*T, where T is the time >> between samples. For example, the duration, by my >> definition, of the following five-sample sequence >> is 4*T: >> >> * >> * >> * * * >> >> ------------------- >> >> For me, the word "duration" is defined as the time >> difference between the first and last samples. >> Is that a "valid" definition? I thought it was. > >
Hi Richard,
>It seems to me, the ascii art may be a little misleading. T is not the >position so much as the distance (duration) between points.
Yep, that's right. I wrote: "... where T is the time between samples."
>By your >argument, if we redraw the points like this: > > * (*) > * > * * * > ^ ^ > a b > > the repeat of the cycle is at (a) rather than at (b). The duration >after the final point must be accounted for, so the total is 0...b (or >5*T), not 0...a.
Oh shoot. I'm not able to understand what you're telling me, but thanks anyway. [-Rick-]
Rick,

Thanks!

fred harris' Fig 1 and 2 get at the issue that *I* think we're 
discussing here.

Thanks for your clarification to Dillip's post.

To put my own words to it:

I agree that the *duration* is (N-1)*T which is what I think you said 
... where N is the number of samples and T is the sample interval.
This agreement is in the case of (shall we say?) infinite time with all 
other samples zero-valued.  In other words, the waveform under 
consideration is a "blip in time".

Then we can say, if we want, that we've applied a rectangular window and 
that the spectral character of the result is what we all know and 
understand as a convolution by a sinc in frequency.

Note that up to now I've not mentioned anything about discrete frequency 
or frequency sampling - just time sampling.  So, all this applies for T 
infinitely small with the continuous case in the limit.

And, we can apply this definition to the "duration of a single period" 
if there is an integral number of samples per period.  That is, we can 
represent a single cycle of what might have underlying definition in 
terms of a periodic waveform or function (such as a sinusoid or a 
sawtooth or .... ) with period length (N-1)*T with N samples or
1*(N-1) + 1.
We can likewise represent M cycles of the same underlying function with
M*(N-1)*T + 1 samples.

*BUT*, if we are going to do a DFT, then we take a leap and say that we 
are going to have not only discrete time but also discrete frequency. 
And, for most of us, discrete frequency means periodic in time.
So, we are no longer dealing with a function as above that's a "blip in 
time" but a periodic (and thus infinite) function of time.  And, we are 
assuming that we are dealing with a single period.
Again, we could reduce the frequency sample interval to an infinitesimal 
value to the point where the temporal extent is infinite.  But, that's 
often inconvenient (I think that Fourier and others figured that out). 
So, we deal with single cycles or periods.  while understanding that 
what we have instead of a "blip" is a "snapshot".

In order to deal with that, we have to leave off the "+1" above because 
we are assuming a periodic waveform instead of a "blip in time".

I'm sorry if I've repeated anyone else in this thread too much.  It just 
helps me to write it out and I do hope this helps.

[A FIR filter unit sample response is a good example of a "blip in time" 
and one where we often expect to see temporal symmetry.  When we decide 
to do filtering by multiplication in frequency then we have to be 
careful about this.  Generally the filter is going to be zero-padded 
anyway so dropping the "+1" isn't an issue / that is, isn't what we want.
BUT what about applying a window function in time?  That's another blip 
in time and one which generally starts out being symmetric in time but 
should not end up being symmetric due to dropping the "+1".  That is, we 
should compute the temporal window function and then drop the last 
sample before applying it (multiplying in time) if we are going to 
compute a DFT.  But, I think that much of the time this isn't done is it?]

Fred