DSPRelated.com
Forums

Energy in a signal as a function of sampling

Started by Andy365 March 24, 2011
Hello again gurus,
assume we sample an analog signal: gi=g(i*dt).

The real energy of the signal is given by the integral of the square
of the signal:
E=integral[ |g(t)|^2*dt ]

However when we use n samples we approximate this integral with a
finite sum:
En=sum[ |gi|^2*dt ]

This sum should approach the integral as n is increasing:
lim n->infinity { En } = E

Since En != E there is an "error" associated with sampling a signal.

Assume we find the frequency spectrum of the signal:
G(f) = DFT[ g(t) ]

1.
How will this "error" appear in the Fourier space?

2.
We all know that when sampling we should follow Nyquist to avoid
aliasing:
dt<=1/(2*fmax)
Should we also study how the energy resulting from our sampling: En
approaches E as a function of n,
and then choose a sampling so large that En/E ~= 1?


Thanks in advance for any answers!
Andreas Werner Paulsen

Andy365 wrote:

> Hello again gurus,
No gurus. DSP = Dipshits, Stupidents and Posers (c) Jacobsen.
> assume we sample an analog signal: gi=g(i*dt). > > The real energy of the signal is given by the integral of the square > of the signal: > E=integral[ |g(t)|^2*dt ] > > However when we use n samples we approximate this integral with a > finite sum: > En=sum[ |gi|^2*dt ] > > This sum should approach the integral as n is increasing: > lim n->infinity { En } = E > > Since En != E there is an "error" associated with sampling a signal.
This is what the aliasing error is about. Finite n -> finite length -> infinite spectrum -> aliasing.
> Assume we find the frequency spectrum of the signal: > G(f) = DFT[ g(t) ] > > 1. > How will this "error" appear in the Fourier space?
As the classic set of the Fourier artifacts due to the finite length of the transform window.
> 2. > We all know that when sampling we should follow Nyquist to avoid > aliasing: > dt<=1/(2*fmax)
I don't know what you all know.
> Should we also study how the energy resulting from our sampling: En > approaches E as a function of n, > and then choose a sampling so large that En/E ~= 1?
It depends on what do you have, what do you need, and what are you trying to do.
> > Thanks in advance for any answers! > Andreas Werner Paulsen
Stupident. VLV
On Mar 24, 11:14&#4294967295;am, Vladimir Vassilevsky <nos...@nowhere.com> wrote:
> Andy365 wrote: > > Hello again gurus, > > No gurus. > DSP = Dipshits, Stupidents and Posers (c) Jacobsen. >
...
> > Stupident.
i guess i'm a poser. which one are you, Vlad? r b-j
On Mar 24, 10:45&#4294967295;am, Andy365 <andreas_w_paul...@yahoo.com> wrote:
> Hello again gurus,
"Ooooommmm..."
> assume we sample an analog signal: gi=g(i*dt). > > The real energy of the signal is given by the integral of the square > of the signal: > E=integral[ |g(t)|^2*dt ] > > However when we use n samples we approximate this integral with a > finite sum: > En=sum[ |gi|^2*dt ] > > This sum should approach the integral as n is increasing: > lim n->infinity { En } = E
on thing that you have to think about a little is dimensional analysis. you must compare apples to apples and your En is in terms of volts^2 (assuming g_i or g(t) is in volts) and E is in volt^2 * time. not the same species of animal.
> Since En != E there is an "error" associated with sampling a signal. > > Assume we find the frequency spectrum of the signal: > G(f) = DFT[ g(t) ] >
i don't think that the *discrete* FT operates on the continuous-time g(t).
> 1. > How will this "error" appear in the Fourier space? > > 2. > We all know that when sampling we should follow Nyquist to avoid > aliasing: > dt<=1/(2*fmax) > Should we also study how the energy resulting from our sampling: En > approaches E as a function of n, > and then choose a sampling so large that En/E ~= 1? > > Thanks in advance for any answers! > Andreas Werner Paulsen
On Mar 24, 4:14&#4294967295;pm, Vladimir Vassilevsky <nos...@nowhere.com> wrote:
> Andy365 wrote: > > Hello again gurus, > > No gurus. > DSP = Dipshits, Stupidents and Posers (c) Jacobsen. > > > assume we sample an analog signal: gi=g(i*dt). > > > The real energy of the signal is given by the integral of the square > > of the signal: > > E=integral[ |g(t)|^2*dt ] > > > However when we use n samples we approximate this integral with a > > finite sum: > > En=sum[ |gi|^2*dt ] > > > This sum should approach the integral as n is increasing: > > lim n->infinity { En } = E > > > Since En != E there is an "error" associated with sampling a signal. > > This is what the aliasing error is about. > Finite n -> finite length -> infinite spectrum -> aliasing. > > > Assume we find the frequency spectrum of the signal: > > G(f) = DFT[ g(t) ] > > > 1. > > How will this "error" appear in the Fourier space? > > As the classic set of the Fourier artifacts due to the finite length of > the transform window. > > > 2. > > We all know that when sampling we should follow Nyquist to avoid > > aliasing: > > dt<=1/(2*fmax) > > I don't know what you all know. > > > Should we also study how the energy resulting from our sampling: En > > approaches E as a function of n, > > and then choose a sampling so large that En/E ~= 1? > > It depends on what do you have, what do you need, and what are you > trying to do. > > > > > Thanks in advance for any answers! > > Andreas Werner Paulsen > > Stupident. > > VLV
Thank you VLV for your answer! So you are saying that the difference in energy between the continous and the discrete case is the same effect as aliasing? A practical problem with Nyquist is that we need to know fmax beforehand (e.g. maybe the signal was lowpassfiltered to fmax by an analog process). If I have an analog signal with an unknown fmax; could I not then use a plot of En(n) to determine an appropriate n? As n -> infinity En would approach E. From such a plot I may e.g. conclude that n=1024 samples would be sufficient since E1024 seemed to be very close to the asymptotical E. Andreas W. P.
On Mar 24, 4:28&#4294967295;pm, robert bristow-johnson <r...@audioimagination.com>
wrote:
> On Mar 24, 10:45&#4294967295;am, Andy365 <andreas_w_paul...@yahoo.com> wrote: > > > Hello again gurus, > > "Ooooommmm..." > > > assume we sample an analog signal: gi=g(i*dt). > > > The real energy of the signal is given by the integral of the square > > of the signal: > > E=integral[ |g(t)|^2*dt ] > > > However when we use n samples we approximate this integral with a > > finite sum: > > En=sum[ |gi|^2*dt ] > > > This sum should approach the integral as n is increasing: > > lim n->infinity { En } = E > > on thing that you have to think about a little is dimensional > analysis. &#4294967295;you must compare apples to apples and your En is in terms > of volts^2 (assuming g_i or g(t) is in volts) and E is in volt^2 * > time. &#4294967295;not the same species of animal. > > > Since En != E there is an "error" associated with sampling a signal. > > > Assume we find the frequency spectrum of the signal: > > G(f) = DFT[ g(t) ] > > i don't think that the *discrete* FT operates on the continuous-time > g(t). > > > > > 1. > > How will this "error" appear in the Fourier space? > > > 2. > > We all know that when sampling we should follow Nyquist to avoid > > aliasing: > > dt<=1/(2*fmax) > > Should we also study how the energy resulting from our sampling: En > > approaches E as a function of n, > > and then choose a sampling so large that En/E ~= 1? > > > Thanks in advance for any answers! > > Andreas Werner Paulsen- Hide quoted text - > > - Show quoted text -
Sorry Robert, should be Gi=G(fi) = DFT[ gi=g(ti) ] When it comes to dimension: no both the integral and the sum has the dimension: Volt^2*time. A.W.P.
On Mar 24, 9:45&#4294967295;am, Andy365 <andreas_w_paul...@yahoo.com> wrote:

> The real energy of the signal is given by the integral of the square > of the signal: > E=integral[ |g(t)|^2*dt ]
OK. The signal is rect(t) which has value 1 for |t| < 0.5 and value 0 for |t| > 0.5. Thus, it is easy to compute that E = 1.
> > However when we use n samples we approximate this integral with a > finite sum: > En=sum[ |gi|^2*dt ] > > This sum should approach the integral as n is increasing: > lim n->infinity { En } = E
OK. Let's sample rect(t) at n points spaced 0.3 apart, i.e. at t = ...., -0.6, -0.3, 0, 0.3, 0.6, ... etc. So, En = 3 as n increases and so the limit does not approach E = 1; the limit is 3. Oh, you mean the n points are spaced closer and closer together as n increases? Well, in that case, more and more points fall in the interval (-0.5,0.5) and so En is an increasing function on n that does not converge to a limit. So, how exactly are you doing the sampling, and in what sense does sum[ |gi|^2*dt ], which I assume means sum[ |g(t_i)|^2 ], approach E? (Hint: reading about Riemann sums and paying attention to the details of the Delta's might help here.] --Dilip Sarwate
On Mar 24, 5:12&#4294967295;pm, dvsarwate <dvsarw...@yahoo.com> wrote:
> On Mar 24, 9:45&#4294967295;am, Andy365 <andreas_w_paul...@yahoo.com> wrote: > > > The real energy of the signal is given by the integral of the square > > of the signal: > > E=integral[ |g(t)|^2*dt ] > > OK. &#4294967295;The signal is rect(t) which has value 1 for |t| < 0.5 > and value 0 for |t| > 0.5. &#4294967295;Thus, it is easy to compute > that E = 1. > > > > > However when we use n samples we approximate this integral with a > > finite sum: > > En=sum[ |gi|^2*dt ] > > > This sum should approach the integral as n is increasing: > > lim n->infinity { En } = E > > OK. &#4294967295;Let's sample rect(t) at n points spaced 0.3 apart, i.e. > at t = ...., -0.6, -0.3, 0, 0.3, 0.6, ... etc. &#4294967295;So, En = 3 > as n increases and so the limit does not approach E = 1; the > limit is 3. > > Oh, you mean the n points are spaced closer and closer together > as n increases? &#4294967295;Well, in that case, more and more points fall > in the interval (-0.5,0.5) and so En is an increasing function > on n that does not converge to a limit. > > So, how exactly are you doing the sampling, and in what sense > does sum[ |gi|^2*dt ], which I assume means sum[ |g(t_i)|^2 ], > approach E? &#4294967295;(Hint: reading about Riemann sums and paying > attention to the details of the Delta's might help here.] > > --Dilip Sarwate
Hello Dilip, in the case of rect(t) the sum goes from t=-0.5->0.5 over n samples so: dt=(0.5-(-0.5))/n = 1/n. Therefore: En = sum[ |1|^2*1/n] = 1 for every n. A.W.P.
On Mar 24, 12:38&#4294967295;pm, Andy365 <andreas_w_paul...@yahoo.com> wrote:

> > Hello Dilip, > in the case of rect(t) the sum goes from t=-0.5->0.5 over n samples > so: dt=(0.5-(-0.5))/n = 1/n. > Therefore: > En = sum[ |1|^2*1/n] = 1 for every n. > > A.W.P.
But n samples have n-1 spaces between them, so dt = 1/(n-1) and so En = n/(n-1) and converges to 1 from above. You really need to pay attention to the details if you are going to be asking questions like the ones you raised in your original post, where you didn't bother to define dt, seemed unaware of the difference between the DFT and the continuous-time Fourier transform, and so on. --Dilip Sarwate
On Mar 24, 7:00&#4294967295;pm, dvsarwate <dvsarw...@yahoo.com> wrote:
> On Mar 24, 12:38&#4294967295;pm, Andy365 <andreas_w_paul...@yahoo.com> wrote: > > > > > Hello Dilip, > > in the case of rect(t) the sum goes from t=-0.5->0.5 over n samples > > so: dt=(0.5-(-0.5))/n = 1/n. > > Therefore: > > En = sum[ |1|^2*1/n] = 1 for every n. > > > A.W.P. > > But n samples have n-1 spaces between them, so dt = 1/(n-1) > and so En = n/(n-1) and converges to 1 from above. You > really need to pay attention to the details if you are > going to be asking questions like the ones you raised in > your original post, where you didn't bother to define dt, > seemed unaware of the difference between the DFT and the > continuous-time Fourier transform, and so on. > > --Dilip Sarwate
Hello Dilip, yes you are right. So from the above E101 = 101/100=1.01. This is 1 % more energy than the continous case (E=1). SInce this is a very small "error" can we conclude that choosing n = 101 samples would suffice? How does this "error" relate to aliasing? To me it seems that Vladimir advocates that these are the same thing. I do not understand how this can be, since Nyquist specify a sampling rate above which there will be no aliasing, whereas the "energy error" (En/E - 1) will never fully vanish. Andreas Werner Paulsen