The Designer's Guide Community Forum
https://designers-guide.org/forum/YaBB.pl Design >> Mixed-Signal Design >> sinusoida ADC output for FFT https://designers-guide.org/forum/YaBB.pl?num=1325873498 Message started by singh on Jan 6th, 2012, 10:11am |
Title: sinusoida ADC output for FFT Post by singh on Jan 6th, 2012, 10:11am i need to calculate FFT of the sinusoidal output of incremental ADC with 16 bit resolution In order to achieve sinusoidal output vs input samples, i gave ramp input voltage amplitude from 0 to 3V for 20000 samples in sin function with fixed frequency freq =1 and fs = 60K with ADC cycles 257 and veried the phase from 0 to 2pi. algorithm: for vin = 0 to 3 with step input v =3/20000 for phase = 0 to 2pi output = ADCout(vin,freq,phase,fs); end rmsout = sqrt(mean(output)) end plot(rmsout) ADCout is function which has sin wave input function = vin*sin(2pi*f/fs*i/n) where n are number of cycles =257 and i varies from 1 to n but i dont get the sinusoidal output function wrt samples, so that i can take fft. Am i doing it the right way? |
Title: Re: sinusoida ADC output for FFT Post by ywguo on Jan 9th, 2012, 12:45am I don't understand what you are doing. Just apply a sine wave input and measure the output. Yawei |
Title: Re: sinusoida ADC output for FFT Post by singh on Jan 9th, 2012, 1:58am in order to plot 16000 samples Vs ADC output,do i need to apply sin wave with 16000 different frequencies? eg ADC out = adc(amplitude,freq,phase,OSR); inside adc function [ for i = 1 to OSR input = amplitude* sin(2pi*f*i/OSR + phase) do all ADC stuff end filter section output ] now when i feed my OSR of 128 ,amplitude =2.8V ,freq of 1KHz phase =0, the sin wave genertaed at input is shown in attached figure.but at the output of digital filter, i just get one value from the ADC output for the whole sin wave input and not the sin wave output :-/ |
Title: Re: sinusoida ADC output for FFT Post by loose-electron on Jan 9th, 2012, 11:52am single sinusoid at one frequency. Do an FFT of the output. I believe thats what you are looking for? |
Title: Re: sinusoida ADC output for FFT Post by ywguo on Jan 9th, 2012, 5:40pm Singh, Now that OSR = 128, you get one number at the ADC output when you apply an input that is 128×Fs. If the clock frequency is Fclk, and Fclk = OSR × Fs. Just apply a sine wave at the input. The input signal frequency is Fsig = Fclk × n / 2m. n is a odd number so that n and 2m are coprime numbers. Then do 2m-point FFT with the ADC output data. Choose a big enough number for 2m so that the frequency bin is small enough to identify signal, distortion, and noise. You need to read a book named Understanding Delta-Sigma Data Converters. http://www.designers-guide.org/Books/#Schreier-2004 Yawei |
Title: Re: sinusoida ADC output for FFT Post by singh on Jan 10th, 2012, 2:06am ywguo wrote on Jan 9th, 2012, 5:40pm:
thanks yawei for detailed explanation :) thank you loose electron |
Title: Re: sinusoida ADC output for FFT Post by singh on Jan 10th, 2012, 7:34am ok..i was able to plot output sinusoidal plot for ADC (fig 1 attached) input f = 15 sampling f = 2^14 no of samples = 2^14 i tried to plot FFT for that but i get too many harmonics (fig 2 attached).. is it fine becoz wen i calculate SNR of output it comes around 4.416 dB.sometime i think i am calculating it wrong becoz by seeing the picture it doesnt seem bad? please let me know the script to calculate power and SNR? and also how to suppress the first bin before the fundamental as i had to put dc offset in my input sin function due to which thr is one peak before fundamental peak? |
Title: Re: sinusoida ADC output for FFT Post by loose-electron on Jan 10th, 2012, 3:38pm The noise floor is 120dB down from the carrier. Why do you say that the harmonics are too large? |
Title: Re: sinusoida ADC output for FFT Post by Dan Clement on Jan 10th, 2012, 6:47pm Maybe if you zoom in you see some spectral leakage that looks like distortion? Maybe play around with different windows? It's hard to tell since all the frequencies are there. Maybe include one with a zoomed in region near the fundamental. Matlab has some built in functions for calculating SNR doesn't it? If not most circuit textbooks explain the theory. |
Title: Re: sinusoida ADC output for FFT Post by singh on Jan 11th, 2012, 1:49am loose-electron wrote on Jan 10th, 2012, 3:38pm:
i was calculating SNR wrong (4.046 dB) which is weird seeing this fft plot....thats why i was wondering..now i have fixed that and got SNR around 98 dB for 16 bit with 255 OSR now i have one doubt regarding measuring total harmonic distortion as from the definition given in (page 6) : http://www.analog.com/static/imported-files/tutorials/MT-003.pdf suppose my fundamental peak bin is 7 ,so do i need to measure sum of five highest harmonic (distortion D) power values after fundamental or i need to measure harmonics at bin 14,21,28.... and then get it divided by signal power? |
Title: Re: sinusoida ADC output for FFT Post by raja.cedt on Jan 12th, 2012, 1:34pm seems all your harmonics are in the same level (more or less)?? |
Title: Re: sinusoida ADC output for FFT Post by ywguo on Jan 15th, 2012, 10:22pm Hi Sing, You need to sum all harmonics at bin 14, 21, 28 ... There are not any distinguishable harmonics in the FFT plot, I mean that all harmonics are below the noise floor. But it is correct to sum all harmonics which are integer multiples of signal frequency. Of course only the sum of the first few harmonis, saying 10 or 20 harmonics. Yawei |
Title: Re: sinusoida ADC output for FFT Post by singh on Jan 17th, 2012, 8:03am Hello, i was just wondering how i can see the power spectral density of the output of ADC...i mean signal and noiseshaping spectrum from the output of the ADC ( signal at low frequency and noise curve thrown at high frequency) if i apply FFT tothe output code,i get the picture posted above. how shud i do that? |
Title: Re: sinusoida ADC output for FFT Post by ywguo on Jan 18th, 2012, 10:36pm I thought there was a decimation filter in your ADC. Could you please show a block diagram of your ADC? -- Yawei |
Title: Re: sinusoida ADC output for FFT Post by singh on Jan 19th, 2012, 6:24am ywguo wrote on Jan 18th, 2012, 10:36pm:
i am using ADC architecture attached in the link. yes there is filter (accumulator + counter). it is initialized before every conversion. suppose y is filter output and xx(i) contains comparator outputs for n cycles y = 0; for i = 1 to n y = y + xx(i); end output_ADC = y; now how i check my output spectrum if i remove this filter function? if i remove my filter functionality, I will just have compartor output values and output voltages of the integrators? how i see the spectrum of both signal and noise together? |
The Designer's Guide Community Forum » Powered by YaBB 2.2.2! YaBB © 2000-2008. All Rights Reserved. |