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.

  • $\begingroup$ "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. $\endgroup$ Mar 20, 2016 at 22:13
  • $\begingroup$ Are you using matlab? The documentation has several examples of how to plot a spectrum with the FFT. $\endgroup$
    – MBaz
    Mar 20, 2016 at 22:21
  • 1
    $\begingroup$ i am using c++ but i need to implement it from first principles $\endgroup$
    – shorty
    Mar 20, 2016 at 22:24
  • 1
    $\begingroup$ @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. $\endgroup$
    – Fat32
    Mar 20, 2016 at 22:42

2 Answers 2


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.


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:

  • Phase (radians and/or degrees)
  • Absolute value

Usually, having a set of different representations will help you to understand the meaning of your data. It can be very helpful if you find some other signal representation that you would like to use as a benchmark, but also you can learn how to extract the information from complex signals like the ones in this post.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.