Reply by Rick Lyons August 22, 20052005-08-22
On 13 Aug 2005 11:21:08 -0700, "Rune Allnor" <allnor@tele.ntnu.no>
wrote:

  (snipped)

>> Another question that raises is what the maximum value is for the >> magnitude when using 16bit integer samples. My guess is it would be >> sqrt(2) times the maximum for the real (cos) and imaginary (sin) part, >> because it is defined as sqrt(Re[f]^2 + Im[f]^2). Is this correct? And >> am I correct saying that the maximum for Re and Im equals 32768 * N/2? >> >> Hope anyone can help my out in understanding these question or perhaps >> point me to more information. Thanks in advance. > >Check out Rick Lyons' "Understanding Digital Signal Processing", >2nd ed., Prentice Hall 2004. > >Rune
Hi, well, ... for the standard radix-2 FFT, if the FFT input is a real-valued sinewave whose frequency is exactly at an FFT bin center (some integer multiple of FS/N), and the sinewave's peak value is A, then the FFT magnitude for that spectral component will be AN/2. See Ya', [-Rick-]
Reply by Fred Marshall August 14, 20052005-08-14
"Sjaak" <joost.ham@gmail.com> wrote in message 
news:1123953059.974767.52070@f14g2000cwb.googlegroups.com...
>I just started with DSP and think this is a simple question. I'm mostly > interested in audio processing using FFT. My question is, what is the > maximum resolution of the phase (for each frequency)? i.e. When > transforming a 1024 samples signal (each 16bit integer for audio), the > first frequency, f=0, can only be zero or PI (plus or minus DC). The > last frequency, f=512, can also only be zero or PI if I'm correct. This > is because it has to be represented by 1024/512=2 samples per cycle, > this can only be done by the upper and lower values, any other values > would change the magnitude not the phase. One could say that the > resolution of the phase of f=0 and f=512 equals 2 [0,PI]. What about > the other values for f? > > I can imagine that when using real numbers for the inputsignal, the > resolution would be virtual infinite. But when using an audio signal > with 16bit integers, I can imagine that the first frequency, f=1, can > only contain 1024 different phases. Is this correct?
A length N FFT results in N complex samples - with Real and Imaginary parts. These occur at frequencies starting at zero and at intervals of 1/NT where T is the temporal sampling interval. Thus, the highest frequency is at (N-1)/NT ... and it repeats from zero at 1/T, the sampling frequency. Phase and amplitude are calculated from these samples - thus at the same frequencies. So, phase and amplitude resolution, like Real and Imaginary term resolution is 1/NT. What do you mean by "the last frequency"? As above, it is (N-1)/NT which is nearly at the sampling frequency. For N=1024, and T=1 for convenience, this is 1023/1024 Hz. Oh, it appears you'd rather have the temporal sample length be 1 second so that the sampling interval T=1/N and the sample rate fs = 1/T = N ... OK. In that case, the sampling frequency is 1024 and the maximum frequency out of a normal FFT os 1023. Then, fs/2 = 512 which is 1 frequency sample interval greater than the maximum frequency allowed by the Nyquist criterion .. if that's what you meant by maximum frequency. In that case, the maximum allowable frequency is 511 but you may well FFT a length 1024 record and get a nonzero value at f=512. Whether the inputs are real or not, all this applies. So the resolution isn't any better and not "virtually infinite". Only increasing N will improve the resolution of an FFT. Sometimes it's useful to think of an FFT of a real set of samples as an FFT of a set of complex samples that have zero imaginary part. The fact that some particular program you use may only admit real sample inputs is just an implementation detail. So, 1024 complex in yields 1024 complex out and 1024 Real in is just a special case that also yields 1024 complex out. If the input is Real, then the Real output is Even and the Imaginary output is Odd. This makes the amplitude Even - there are some number of such identities that are useful at times. Fred
Reply by Rune Allnor August 13, 20052005-08-13
Sjaak skrev:
> I just started with DSP and think this is a simple question. I'm mostly > interested in audio processing using FFT. My question is, what is the > maximum resolution of the phase (for each frequency)? i.e. When > transforming a 1024 samples signal (each 16bit integer for audio), the > first frequency, f=0, can only be zero or PI (plus or minus DC). The > last frequency, f=512, can also only be zero or PI if I'm correct.
This is correct, providied the input to the FFT is real-valued.
> This > is because it has to be represented by 1024/512=2 samples per cycle, > this can only be done by the upper and lower values, any other values > would change the magnitude not the phase.
Although I don't have the faintest idea what you mean, I suspect your explanation is wrong. The phase properties at DC and at fs/2 are due to the symmetry properties of the DFT for real-valued data and has nothing to do with numerical representations or sampling.
> One could say that the > resolution of the phase of f=0 and f=512 equals 2 [0,PI]. What about > the other values for f? > > I can imagine that when using real numbers for the inputsignal, the > resolution would be virtual infinite. But when using an audio signal > with 16bit integers, I can imagine that the first frequency, f=1, can > only contain 1024 different phases. Is this correct?
No. You are hinting at quantization effects. These introduce more or less random noise into the data, but does not introduce quantization on the phase.
> Another question that raises is what the maximum value is for the > magnitude when using 16bit integer samples. My guess is it would be > sqrt(2) times the maximum for the real (cos) and imaginary (sin) part, > because it is defined as sqrt(Re[f]^2 + Im[f]^2). Is this correct? And > am I correct saying that the maximum for Re and Im equals 32768 * N/2? > > Hope anyone can help my out in understanding these question or perhaps > point me to more information. Thanks in advance.
Check out Rick Lyons' "Understanding Digital Signal Processing", 2nd ed., Prentice Hall 2004. Rune
Reply by Sjaak August 13, 20052005-08-13
I just started with DSP and think this is a simple question. I'm mostly
interested in audio processing using FFT. My question is, what is the
maximum resolution of the phase (for each frequency)? i.e. When
transforming a 1024 samples signal (each 16bit integer for audio), the
first frequency, f=0, can only be zero or PI (plus or minus DC). The
last frequency, f=512, can also only be zero or PI if I'm correct. This
is because it has to be represented by 1024/512=2 samples per cycle,
this can only be done by the upper and lower values, any other values
would change the magnitude not the phase. One could say that the
resolution of the phase of f=0 and f=512 equals 2 [0,PI]. What about
the other values for f?

I can imagine that when using real numbers for the inputsignal, the
resolution would be virtual infinite. But when using an audio signal
with 16bit integers, I can imagine that the first frequency, f=1, can
only contain 1024 different phases. Is this correct?

Another question that raises is what the maximum value is for the
magnitude when using 16bit integer samples. My guess is it would be
sqrt(2) times the maximum for the real (cos) and imaginary (sin) part,
because it is defined as sqrt(Re[f]^2 + Im[f]^2). Is this correct? And
am I correct saying that the maximum for Re and Im equals 32768 * N/2?

Hope anyone can help my out in understanding these question or perhaps
point me to more information. Thanks in advance.