Reply by mnentwig September 18, 20072007-09-18
Hello,

>Yes we are processing measured data. I will double check with the >hardware >provider whether there are space left.
Probably you sample at a higher rate, and there are FFT bins that contain only noise and can be discarded. If not, beware. What happens to signal energy just above the Nyquist limit?
>Our measurement equipment is synchronized with the signal, so the >rectangular is good enough.
As long as you capture a full number of periods it should be OK. I hate to make simple things complicated. BUT if it's not good enough, the problems may be easier to fix before you buy the hardware.
>> So the convolution is done in the frequency domain?
Consider it a sneaky way to sum up the bins as in the first example. This convolution is not done on the signal, but on the power spectrum. Look at it long enough and you'll see that it can give the same result on the "nominal" bin as summing up the bins. If the signal energy is clearly confined to one bin, then reading from one bin is enough, and possibly even the most accurate. Just look at the power spectrum, and you'll see how much energy 'leaks' into adjacent bins by whatever mechanism. -mn
Reply by Brian Zhang September 17, 20072007-09-17
On Sep 17, 4:13 pm, "mnentwig" <mnent...@elisanet.fi> wrote:
> One comment to the original poster: > > >> For the power, should it be 2*((a3/N)^2 + (a6/N)^2 + (a9/N)^2), when > > FFT > that looks OK, but verify your scaling factors against known examples. > Since the bins are complex, it might actually be better to use c * conj(c) > for squaring. > It might have been me who brought up the "a"s, but never mind... > > But: > > I get the impression you are processing measured data? > > If so, forget about the Nyquist limit!! > > Chances are 99.9% that you need to leave some frequency space unused to > account for nonideal equipment. > I'd try to do so in any case, just to avoid the "stepping-on-Nyquist's > feet" issue discussed above. In typical measurement problems it's just > plain common sense.
> And something else: > > If your measurement equipment is synchronized with the signal (reference > clock), then you can sample the data using a rectangular window and > immediately read from a single FFT bins. If not, you need to account for > frequency error, consider adjacent bins, and use a non-rectangular > window. > > Then, to make things a bit more complicated: > So far the window sets your frequency resolution, but the actual frequency > error may be higher (and: the longer your measurement time, the narrower > the "aperture" from windowing on the frequency axis). > > If so, I could, for example: > > - sum up the power from adjacent bins, for example 990-1010, if 1000 is > the center frequency => allows roughly +/- 1% frequency offset relative to > fs. > > or: > - Convolve the power spectrum with a window function, for example [1 1 1 1 > 1 1 1 1 1 1]/10 and read off the power from the center bin (this example > window is effectively only half as wide as the previous) > > It's inconvenient from an analytical point-of-view, but that's also what a > real (hardware) spectrum analyzer does: it sweeps a filter with a given > filter response. > > -mn
Markus, Yes we are processing measured data. I will double check with the hardware provider whether there are space left. Our measurement equipment is synchronized with the signal, so the rectangular is good enough. Then do we still need the last two ways you mentioned? The first way is clear. I don't get the second one. So the convolution is done in the frequency domain? How will it affect a spectrum? Could you recommend any reference for this? Thanks, Brian
Reply by mnentwig September 17, 20072007-09-17
>> +/- 1% frequency offset relative to fs.
correction: to the inverse of the measurement length. -mn
Reply by Ron N. September 17, 20072007-09-17
On Sep 17, 12:46 pm, "mnentwig" <mnent...@elisanet.fi> wrote:
> >Jerry > >__________________________________ > >* Both cosine and DC are odd-power terms. The sine term, being even, > >can't alias with DC. Since there's no other way it can be represented, > >it quietly retires from the field of play. > > .. and feels sorry for itself. > > IMO the question gets much more straightforward, if I forget sine and > cosine and think in terms of rotating phasors instead. Or in other words: > complex exponentials. > > So what I am offering is: > A less complex explanation. By using complex numbers.
To result in a real valued signal, the only way to get it from complex phasors is to have two counter-rotating phasors where the imaginary terms exactly cancel. But the DC term and the Fs/2 term don't have a term that can counter-rotate, so these phasors can't rotate at all for any real valued time-domain signal, they have to stay stuck in the cosine plane. And the imaginary portion of the two Sinc functions (one for each counter-rotating phasor) cancel out as the frequency approaches DC or Fs/2. IMHO. YMMV. -- rhn A.T nicholson d.0.t C-o-M
Reply by mnentwig September 17, 20072007-09-17
One comment to the original poster:

>> For the power, should it be 2*((a3/N)^2 + (a6/N)^2 + (a9/N)^2), when
FFT that looks OK, but verify your scaling factors against known examples. Since the bins are complex, it might actually be better to use c * conj(c) for squaring. It might have been me who brought up the "a"s, but never mind... But: I get the impression you are processing measured data? If so, forget about the Nyquist limit!! Chances are 99.9% that you need to leave some frequency space unused to account for nonideal equipment. I'd try to do so in any case, just to avoid the "stepping-on-Nyquist's feet" issue discussed above. In typical measurement problems it's just plain common sense. And something else: If your measurement equipment is synchronized with the signal (reference clock), then you can sample the data using a rectangular window and immediately read from a single FFT bins. If not, you need to account for frequency error, consider adjacent bins, and use a non-rectangular window. Then, to make things a bit more complicated: So far the window sets your frequency resolution, but the actual frequency error may be higher (and: the longer your measurement time, the narrower the "aperture" from windowing on the frequency axis). If so, I could, for example: - sum up the power from adjacent bins, for example 990-1010, if 1000 is the center frequency => allows roughly +/- 1% frequency offset relative to fs. or: - Convolve the power spectrum with a window function, for example [1 1 1 1 1 1 1 1 1 1]/10 and read off the power from the center bin (this example window is effectively only half as wide as the previous) It's inconvenient from an analytical point-of-view, but that's also what a real (hardware) spectrum analyzer does: it sweeps a filter with a given filter response. -mn
Reply by Brian Zhang September 17, 20072007-09-17
On Sep 17, 2:28 pm, Brian Zhang <sunny...@myrealbox.com> wrote:
> On Sep 14, 4:47 pm, "mnentwig" <mnent...@elisanet.fi> wrote: > > > > > Hello, > > > The Nyquist limit is "one-sided": For either positive or negative > > frequencies you can or cannot reconstruct the signal. It's up to what you > > decide beforehand, when you lowpass (bandpass)-filter the signal: > > > - include Nyquist frequency on negative side, exclude on positive side of > > frequency axis > > - vice versa > > > It matters for example when I use FFT to delay a signal:http://www.elisanet.fi/mnentwig/webroot/FFT_delay_special_case/index.... > > andhttp://www.elisanet.fi/mnentwig/webroot/Nyquist_on_the_edge/index.html > > > The first question: You get the amplitude a of a sine wave per frequency. > > > All sine waves (from different bins) are uncorrelated. > > => power is a3^2+a6^2+a9^2 if the harmonics of interest are 3, 6, 9. > > > -mn > > I don't understand how a real value filter can be made to include > Nyquist > frequency on one side. > > I think if we take DFT values on [0, fs), only the positive Nyquist > frequency > is included, right? We just need to be careful not to time it by two > during > reconstruction. From X[fs/2] = 0.5, we can't tell whether a signal is > $0.5 * cos(2 * pi * (fs/2) * t)$ or $cos(2 * pi * (fs/2) * (t - pi/3)) > $ > but I think it's fine since we don't know what happened between > samples > anyway. We can reconstruct it with assumption that phase is zero > based on > what Randy and Andor pointed out. > > For the power, should it be 2*((a3/N)^2 + (a6/N)^2 + (a9/N)^2), when > FFT > length is N? If comparing between harmonics, we don't worry about > scalars, > but we need the exact power value of some frequency in some cases like > common > mode rejection rate. I clumsily proved it below. > > Given a signal x(t) with frequency fk that fk < fs/2. It's continuous > time > power $\int_0^T x(t)^2 dt$ is Xp^2/2 (Xp the peak value). And Xp is > Xk*2/N > (Xk the DFT of x(t) at fk). So I get $\int_0^T x(t)^2 dt = 2 Xk^2$. >
Sorry, mistake again. $\int_0^T x(t)^2 dt = 2 Xk^2 / N^2$.
Reply by Ron N. September 17, 20072007-09-17
On Sep 15, 6:06 pm, Jerry Avins <j...@ieee.org> wrote:
> * Both cosine and DC are odd-power terms. The sine term, being even, > can't alias with DC. Since there's no other way it can be represented, > it quietly retires from the field of play.
For the DFT of a strictly real signal, and least two terms must retire from the field of play, else the degrees of freedom between the time and frequency domains of the transform won't match. No one complains that the DC term's imaginary bin must retire, for any real signal. It doesn't seem as obvious that the sine term at Fs/2 must do the same. But what other choice is there? IMHO. YMMV. -- rhn A.T nicholson d.0.t C-o-M
Reply by mnentwig September 17, 20072007-09-17
>Jerry >__________________________________ >* Both cosine and DC are odd-power terms. The sine term, being even, >can't alias with DC. Since there's no other way it can be represented, >it quietly retires from the field of play.
.. and feels sorry for itself. IMO the question gets much more straightforward, if I forget sine and cosine and think in terms of rotating phasors instead. Or in other words: complex exponentials. So what I am offering is: A less complex explanation. By using complex numbers. Hmmm.... Snake oil, anybody? Cheers Markus
Reply by Brian Zhang September 17, 20072007-09-17
On Sep 14, 4:47 pm, "mnentwig" <mnent...@elisanet.fi> wrote:
> Hello, > > The Nyquist limit is "one-sided": For either positive or negative > frequencies you can or cannot reconstruct the signal. It's up to what you > decide beforehand, when you lowpass (bandpass)-filter the signal: > > - include Nyquist frequency on negative side, exclude on positive side of > frequency axis > - vice versa > > It matters for example when I use FFT to delay a signal:http://www.elisanet.fi/mnentwig/webroot/FFT_delay_special_case/index.... > andhttp://www.elisanet.fi/mnentwig/webroot/Nyquist_on_the_edge/index.html > > The first question: You get the amplitude a of a sine wave per frequency. > > All sine waves (from different bins) are uncorrelated. > => power is a3^2+a6^2+a9^2 if the harmonics of interest are 3, 6, 9. > > -mn
I don't understand how a real value filter can be made to include Nyquist frequency on one side. I think if we take DFT values on [0, fs), only the positive Nyquist frequency is included, right? We just need to be careful not to time it by two during reconstruction. From X[fs/2] = 0.5, we can't tell whether a signal is $0.5 * cos(2 * pi * (fs/2) * t)$ or $cos(2 * pi * (fs/2) * (t - pi/3)) $ but I think it's fine since we don't know what happened between samples anyway. We can reconstruct it with assumption that phase is zero based on what Randy and Andor pointed out. For the power, should it be 2*((a3/N)^2 + (a6/N)^2 + (a9/N)^2), when FFT length is N? If comparing between harmonics, we don't worry about scalars, but we need the exact power value of some frequency in some cases like common mode rejection rate. I clumsily proved it below. Given a signal x(t) with frequency fk that fk < fs/2. It's continuous time power $\int_0^T x(t)^2 dt$ is Xp^2/2 (Xp the peak value). And Xp is Xk*2/N (Xk the DFT of x(t) at fk). So I get $\int_0^T x(t)^2 dt = 2 Xk^2$. Thanks for all the help, Brian
Reply by Ron N. September 16, 20072007-09-16
On Sep 15, 1:43 pm, Randy Yates <ya...@ieee.org> wrote:
> "Ron N." <rhnlo...@yahoo.com> writes: > > On Sep 15, 6:53 am, Randy Yates <ya...@ieee.org> wrote: > >> Andor <andor.bari...@gmail.com> writes: > >> > Fs/2 stays right there. > > >> Really? Then why does sin(n*pi) disappear? > > > Consider sampling a windowed sinusoid approaching either 0 or > > Fs/2. > > Do you mean "approaching" in frequency?
Yes.
> > Within a finite window aperature, the in-phase component > > starts looking like a barely modulated constant or alternating > > constant, and the out-of-phase component starts approaching > > zero, > > What do you mean by "in-phase" and "out-of-phase"? We are > performing real sampling.
The FFT of a real signal is Hermitian symmetric: one component in-phase, or of the same sign, one component out-of-phase, or of the opposite sign (e.g. the imaginary component in a standard FFT), for the corresponding "negative" frequencies. Any real sinusoid of any phase can be broken into these two components. Also, the FFT of a real and windowed sinusoid produces a sampled Sinc. The Sinc will have a Hermitian symmetric mirror image in the negative frequencies. The Sinc, being of infinite extent, will also wrap around and interfere with its own (mirrored) image. Due to Hermitian symmetry, the real component of the images of the Sinc will sum and the imaginary components of the images of the Sinc will cancel as the frequency of the sinusoid approaches either 0 or Fs/2. I think that is one reason :
>>> why does sin(n*pi) disappear?
It also means you can't determine the amplitude of a pure sinusoid with a frequency a fraction of an FFT bin away from either DC or Fs/2. IMHO. YMMV. -- rhn A.T nicholson d.0.t C-o-M