I understand that the magnitude and phase are captured in the real and imaginary parts in the result of an fft. But how does each sample capture phase?
Is the phase related to the N discrete samples provided in time domain?
That is, if the input sample included 44100 samples for a second, then is each resulting value of the FFT represent 1/44100 of the phase?
For example, the first FFT value is at frequency 1/44100 and the second value is 2/44100 and so on?
解决方案
i think you are saying "phase" when you mean "frequency" in some parts of your question?
anyway, if you are asking about frequency, it works pretty much like time in the "input" data. you start with time series data, where each array element is at a different time. after the fft the "output" is similar, but each element is a different frequency.
they range from the constant offset to the highest frequency possible, in uniform steps, but the actual order may depend on the implementation you are using. so each complex number represents amplitude and phase at one particular frequency - you can work out the frequency from the position in the output array.
if you have N points that cover a time T then the highest frequency is N/(2T) and the values are multiples of 1/T (including 0Hz - a constant offset). for example, 60 samples over 1 minute (N=60 T=60s) gives a top frequency of 0.5Hz. there are no higher frequencies because the data are not sampled well enough to pick them out clearly (a 1 Hz signal, for example, could be at its maximum on each sample and so would appear as a constant signal). this limit is called the nyquist frequency
(the above assumes the output is an array of complex numbers; often it's an array of floats/doubles and you need to piece together the complex numbers from real and imaginary values in different parts of the array - it all gets a bit messy, but the concept is the same as if you were returned an array of complex values).
ps typically when i have to use an fft routine from somewhere i make some data that have a constant offset and two known frequency sine waves, then fft that and look at the results. if you make the amplitudes of each component different then it's usually obvious how things are ordered. you can also check the scale, because sometimes that has/omits a factor of 2pi...