You are right. I don't know how the -1 got in there (maybe a typo) because I get -16 as well. I added some text to my copy of the Nyquist FFT Tutorial as follows, which might answer other questions:

Running this prints an array of nearly-zero values except for the 9th element (index 8), which is -16. (In an ideal world, all other values would be exactly zero, but because numerical computation has limited precision, you may see some ugly values like -1.15578e-15. The "e-15" part means 10-to-the-minus-15 power, or 0.000000000000001, which is at least pretty close to zero.) The layout is as follows (remember that the Fourier Transform analyzes a signal as the sum of sines and cosines):

- the DC component goes in array element 0. The
*DC component*is just the coefficient for the zero-frequency cosine component. Since cosine at zero frequency is equal to 1 everywhere, this is just the sum of all the samples. In electrical terms, alternating current (AC) averages to zero, and any non-zero average is the direct current (DC) part. Note that sine of zero is zero, so there is no zero-frequency sine term. - the Cosine part is in elements 2i - 1.
*Cosine part*means the real coefficients of the cosines at various frequencies. - the Sine part is in elements 2i.
*Sine part*means the real coefficients of the sines at various frequencies. - the Nyquist frequency component is in the last element. The
*Nyquist frequency component*is the coefficient for the cosine component at half the sampling rate (which is also called the Nyquist frequency). Note that at the Nyquist frequency, samples of sine would be taken at the angles of 0 and PI, where sine is zero, so there is no Nyquist frequency sine term.

> (load "fft1.lsp") ;loading "fft1.lsp" ;fft-test : (SEND FFT-ITER :NEXT) = ; #(4.89859e-16 0 0 0 0 0 0 2.38419e-07 ; -16 0 0 0 0 0 0 4.89859e-16 ; -0 0 0 0 0 0 0 -2.38419e-07 ; 0 0 0 0 0 0 0 4.89859e-16) ;T ;>

Thus, the element at index 8 is the 4th Sine component, indicating a 4th harmonic as expected. Why is the number -16 rather than -32 or -1? This is just how the FFT is defined. And why -16 rather than +16. Again, if you look closely at the definition, you'll find a minus sign either in front of the sine term or in the complex exponential. While these may not seem to be exactly coefficients of sines and cosines, the FFT and IFFT are carefully defined to be inverses of one another.

View this message in context: Re: Nyquist FFT Tutorial Help

Sent from the audacity-nyquist mailing list archive at Nabble.com.