Have I interpreted the two-sided fast Fourier transform output correctly? - MathOverflow [closed]most recent 30 from http://mathoverflow.net2013-05-19T05:23:25Zhttp://mathoverflow.net/feeds/question/81270http://www.creativecommons.org/licenses/by-nc/2.5/rdfhttp://mathoverflow.net/questions/81270/have-i-interpreted-the-two-sided-fast-fourier-transform-output-correctlyHave I interpreted the two-sided fast Fourier transform output correctly?Benjamin Chabot-Hanowell2011-11-18T17:52:45Z2011-11-18T18:08:01Z
<p>I have a <em>real-valued</em> discrete time series with N = 24 equally spaced periods (actually, I have 1,225 such time series, but let's just concentrate on one). I used the fft() function from the statistical package R to perform an unnormalized fast Fourier transform on the time series. Below, I show the right hand side of the function call.</p>
<pre><code>fft(raw.data$x)
</code></pre>
<p>The output is a vector of length N = 24, and because this is R, the indexing starts at <em>one</em>, <strong>not</strong> <em>zero</em>, so I will refer to R's indices throughout. My questions:</p>
<ol>
<li><p>To convert from a two-sided Fourier transform to a one-sided Fourier transform, do I multiply by two the first half of the frequency elements above frequency 1 (i.e., elements 2 through 13 of the fft output)? Or do I do something else?</p></li>
<li><p>Do I calculate the amplitude and phase angle from the fft output BEFORE I convert from two- to one-sided, or after? And when I calculate the amplitude, do I normalize by dividing by 24, or by 12 since I have converted to one-sided? Or do I need to divide the zero-th frequency by 24 but the rest by 12?</p></li>
<li><p>How do I calculate the variance at a given frequency from the amplitude? So far I have been advised to square the amplitude (which I have calculated after converting to two-sided, but see item 1).</p></li>
<li><p>To calculate the total variance, do I simply sum the squares of the amplitudes or I do I have to divide the sum by two? I think I don't have to divide by two if I have multiplied the first half of the frequency elements by two. Am I right?</p></li>
<li><p>Because phase angle = arctan(Im(fft(x))/Re(fft(x))), but arctan has a range from -pi/2 to pi/2, is it correct that I should add pi to the phase angle to make it a "true" phase angle?</p></li>
</ol>