0
\$\begingroup\$

Say you have an N-bit ADC with reference voltage of +/- 0.5V, it provides you 2's complement formatted binary values. You perform an M-point FFT upon the samples and extract the spectrum results. All of the bins are completely 0 except for one (I know this is unrealistic, but just for the sake of math).

What are the correct steps/functions to convert the complex value of that bin back into the amplitude, in volts, of the original sinusoid as sampled by the ADC. This assumes that it was known that a pure sinewave of constant frequency and amplitude was input into the ADC.

\$\endgroup\$
6
  • 2
    \$\begingroup\$ This 'bin' is completely irrelevant here. Number is number regardless of representation. The "correct steps" are called "IFFT". \$\endgroup\$
    – Eugene Sh.
    Jul 25, 2016 at 13:59
  • \$\begingroup\$ I assumed there would be an "easier" formula as opposed to doing a full IFFT based on the fact that only one bin had energy in it. \$\endgroup\$ Jul 25, 2016 at 14:24
  • \$\begingroup\$ Of course it will reduce to a simple solution as you have the delta function as your transform, meaning your original signal is a simple sine with the given frequency. But you want a general solution, don't you? \$\endgroup\$
    – Eugene Sh.
    Jul 25, 2016 at 14:27
  • \$\begingroup\$ No, I wanted the "simple sine with given frequency" version. \$\endgroup\$ Jul 25, 2016 at 14:29
  • 1
    \$\begingroup\$ This is going to depend on the exact library you're using for the FFT, and whether the FFT has been scaled by the sample rate. IIRC, some packages my also include or leave out a 2*pi scale factor. More importantly, the FFT routine is going to want a particular data type for input, unless its polymorphic, and will provide output of a particular data type as well. I recommend showing code, or at least telling us more about the libraries you are using. For the most part, this is standard programming involving type conversions. \$\endgroup\$ Jul 25, 2016 at 14:36

1 Answer 1

1
\$\begingroup\$

Obviously you can just do the IFFT.

If your question is instead "what waveform does the i'th bin in the FFT output represent", that depends on the particular version of FFT you used. The safe answer is to look up the documentation for your FFT. For instance, a normal FFT vs. a real FFT are two different things. There is also the issue of the ordering (zero frequency at the beginning or at zero?) and overall scale factor. There are standard ways to do this, but some special purpose library might make non-standard choices -- for instance if their only purpose is to plot a spectral density.

The most common "regular" FFT will actually never produce the result you suggested, as the basis waveforms are complex, and your input is real valued. For instance, the waveform: (1/8) * cos(2*pi*x*4/16) for x=0..15 (a cosine with exactly 4 cycles in 16 samples), will have an FFT of [0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0]. On the other hand the real FFT will have the result: [0,0,0,0,1,0,0,0,0] (only 9 elements).

The general form is that an N point RFFT with a '1' in index F represents an ADC waveform: (2/N) * cos(2*pi*F*x/N).

Again, you really have to check the documentation for the function you are using. What I have described is the most standard definition of the FFT. For instance here is the documentation for numpy and scipy:

http://docs.scipy.org/doc/numpy/reference/routines.fft.html#module-numpy.fft

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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