title: power spectral density from fft result c#
body: <p>I have a <code>Complex[]</code> (from CsCore) which is the result of my FFT.</p>
  
  <p><code>Complex</code> has a <code>float real</code> and a <code>float imaginary</code>.</p>
  
  <p>From this I calculated the following  </p>
  
  <ul>
  <li>Frequency: <code>(double)index * sampleRate / FftSize;</code>  </li>
  <li>Amplitude / Magnitude: <code>Math.Sqrt(Math.Pow(real, 2) + Math.Pow(imaginary, 2));</code>  </li>
  <li>Phase: <code>Math.Atan(imaginary / real);</code>  </li>
  </ul>
  
  <p>If these are wrong please correct me.</p>
  
  <p>From what I understand, this is the frequency domain information and it allows me to see which frequencies are most common in my sample. Now I want to see the power density over time. <a href="http://nl.mathworks.com/help/signal/ug/power-spectral-density-estimates-using-fft.html" rel="nofollow noreferrer">Matlab documentation</a> shows examples, But I don't understand it because I don't know Matlab. Could someone explain the Matlab documentation on this subject or help me with a C# implementation?</p>
  
  <p><strong>EDIT:</strong><br>
  <a href="https://stackoverflow.com/questions/24984008/power-spectral-density-of-fft#24987662">This answer</a> suggest to simply square the amplitude. Is that correct?</p>