0
\$\begingroup\$

I have a signed 16 bit ADC which means it maps -10V to +10V range to 16 bit. So the max voltage +10V is 2^15-1 = 32767; zero is 0; and -10V is -2^15 = -32768.

My confusion is that when I perform data-acquisition with such 16 bit hardware and do the FFT with MATLAB or Python tool I dont know how the program know the resolution of the data(like 16-bit). And if I create my own array in MATLAB by coding what would be the bit resolution when it does the FFT.

I don't know if I could articulate where I am stuck at. Basically as I have written before imagine you have a have a signed 16 bit ADC which means it maps -10V to +10V range to 16 bit. So the max voltage +10V is 2^15-1 = 32767; zero is 0; and -10V is -2^15 = -32768. And imagine you have a binary file file full of 16-bit samples recorded by this ADC hardware. Now if you perform FFT in MATLAB or Python these tools will read 16 bit file and convert these unsigned bits to voltage and perform FFT.

But imagine you want to do/mimic the same thing with coding not by using FFT. How would you make such array in MATLAB or Python?

Here is an example: Let's say I want to create/plot a sinusoid in MATLAB or Python where I can mimic exactly that 16 bit ADC which samples a 1V 100Hz sinusoid input for 1 seconds which is sampled with 512Hz sampling rate. At the end I want to obtain the same FFT plot where I would obtain after a real ADC sampling. How can that sort of array be obtained? How does the FFT function know the resolution of the ADC when it calculates the FFT?

\$\endgroup\$
  • \$\begingroup\$ Good FFT results require 10 log (samples per wavelength) and high SNR [dB] from resolution . You only have 10log(512/100) and 10 log (1V/10V *32767) so your FFT result will have noise and low Q frequency response (<10) but the peaks can give some indication but >-70dB of of noise below peaks. \$\endgroup\$ – Tony Stewart Sunnyskyguy EE75 Jul 23 '18 at 19:37
  • \$\begingroup\$ Related question \$\endgroup\$ – Andy aka Jul 24 '18 at 10:01
  • \$\begingroup\$ It looks like your question is about how Mathlab/Phyton converts signed 16-bit integer array into floating point array. What is the issue here? Or is it about how to generate a 16-bit signed data out of a floating-point SIN(t) subroutine? It is very unclear what are you asking about. \$\endgroup\$ – Ale..chenski Jul 31 '18 at 19:59
0
\$\begingroup\$

Let's say I want to create/plot a sinusoid in MATLAB or Python where I can mimic exactly that 16 bit ADC which samples a 1V 100Hz sinusoid input for 1 seconds which is sampled with 512Hz sampling rate.

First, you need to write some code to increment the phase of an angle. You want to create 512 points. If the frequency were 1 Hz, you'd sweep through 2pi radians over the course of 512 samples, but your frequency is 100 Hz so you should increment 100 times as fast.

Then you need the right amplitude. You say 1v (let's assume you mean peak, if not correct accordingly). Full scale on your ADC is 10v, so you want a tenth of that. Full scale output of your ADC is 32767, so you want a tenth of that. The maximum value of the sine function is one. So basically multiply the output of your sine function (evaluated at the angles calculated above) by 32767/10 and then round.

Of course this fake signal will be unrealistically clean - for a more realistic model you could add some noise, etc.

\$\endgroup\$

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.