# FFT output to graph

I have a hydrophone which gives input into my PC as voltage. I have an FFT which uses both real and complex numbers; however the hydrophone output I have set as the real and have set complex to all zero's. The output I get is an array of data in the form (r,c). Given that I collect 500,000 data points every 1 second, how would I plot this on a graph? this is what I can't seem to get my head around.

• "have set complex to all zero's" - do you mean the imaginary part of the complex numbers. 500'000 samples to a DFT will lead to 500'000 coefficients. In an FFT you usually have 2^n samples and the same number of (complex) coefficients again. You can plot imaginary and real part separately or the absolute value (magnitude) and the phase for each coefficient. This depends on what you want to do. Mar 20, 2016 at 22:13
• Are you using matlab? The documentation has several examples of how to plot a spectrum with the FFT.
– MBaz
Mar 20, 2016 at 22:21
• i am using c++ but i need to implement it from first principles Mar 20, 2016 at 22:24
• @shorty a complex number such as $z=a+jb$ consists of a real part "a" and imaginary part "b" which can be represented as (a,b) or as (re,im). It is the sum of real and imaginary parts which makes a complex number. Please adopt this established terminology in your posts. Mar 20, 2016 at 22:42

You could probably improve your question with more detail of what you are trying to do and what the data flow is. You have what I presume is audio data coming in, and I'm guessing you want to know what frequencies are present.

The output of the FFT complex values which encode the magnitude and phase of the various frequencies in your signal. $\sqrt{re^2+im^2}$ will give you the magnitude of each frequency.

Something like $atan2(im,re)$ will give you the phase. You're probably looking to plot one of these types of values.

http://webpages.ursinus.edu/lriley/ref/complex/node1.html

If you are only interested in knowing what the frequency content is, then magnitude is probably what you want. If you are interested in knowing something about how far away the source is or how the sound is being affected by the water, then you want to look at the phase. I would guess that just looking at the phase information visually in degrees or radians won't be useful-- you'll need to take the phase information through your model and then look at the result in meters or whatever you're trying to measure.

You could separate the real and the imaginary part and plot both graphs separately in terms of magnitude.

Then, as suggested in the previous answer, you can plot the complex signal in terms of: