Electronics > Projects, Designs, and Technical Stuff

Signal processing - getting exact frequency from short ADC sample

<< < (5/18) > >>

ogden:
In case of pure sine - normalize amplitude and convert it to polar form. Knowing phasor rotation speed (angular velocity) it is easy to calculate frequency (ω = 2πƒ). In such case accuracy depends on SNR of signal and ADC. It is possible to measure frequency even with just two consecutive samples - using very, very accurate ADC.

Marco:
You can't accurately know amplitude until you accurately know frequency.

Kalvin:
Would it be possible to create a sine wave so that the created sine wave would be the best fit to the captured samples? If that would be possible, we could also get the best estimate to the sampled sine wave frequency.

hamster_nz:
Maybe something more practical.

Apply a bandpass DSP filter (to get rid of as much out of band noise as you can).

Interpolate zero crossing between samples.

Period is 2*(LastZeroCrossTime-FirstZeroCrossTime) /(NumberOfZeroCrossings-1)

Frequency is 1/period.

Kleinstein:

--- Quote from: Kalvin on December 14, 2019, 09:21:22 pm ---Would it be possible to create a sine wave so that the created sine wave would be the best fit to the captured samples? If that would be possible, we could also get the best estimate to the sampled sine wave frequency.

--- End quote ---
This is possible, e.g. with a program like Gnuplot. Here the output for the 12 Bit data given by Hamster_NZ. The Program also calculates an estimated error. Due to the likely exact integer amplitude chosen the error estimate may be a little (some 20-50%) optimistic, as the quantization error may be below typical. This would suggest some 0.5 ppm possible frequency (some 0.005 Hz for the 10 kHz example) resolution from perfect 12 Bit data.


--- Code: ---gnuplot> fit a*sin(b*x)+c*cos(b*x) 'test12bit.dat'  us 1:2 via a,b,c 
.....
Final set of parameters            Asymptotic Standard Error
=======================            ==========================
a               = 2046.56          +/- 0.0326       (0.001593%)
b               = 0.314159         +/- 2.755e-007   (8.77e-005%)
c               = 2.74857e-005     +/- 0.03258      (1.185e+005%)

correlation matrix of the fit parameters:
                a      b      c     
a               1.000
b               0.036  1.000
c              -0.001 -0.017  1.000


gnuplot> fit a*sin(b*x)+c*cos(b*x) 'test12bit.dat'  us 1:3 via a,b,c 
iter      chisq       delta/lim  lambda   a             b             c           
   0 4.1947679263e+01  0.00e+00 1.52e+04  2.046557e+03  3.141593e-01  2.748573e-05
   1 2.0589137226e+01 -1.04e+05 1.52e+03  2.046317e+03  3.141567e-01  2.748573e-05
   2 1.8897496910e+01 -8.95e+03 1.52e+02  2.046187e+03  3.141567e-01  2.748573e-05
   3 1.8897452147e+01 -2.37e-01 1.52e+01  2.046186e+03  3.141567e-01  2.748573e-05
iter      chisq       delta/lim  lambda   a             b             c           

After 3 iterations the fit converged.
final sum of squares of residuals : 18.8975
rel. change during last iteration : -2.36876e-006

degrees of freedom    (FIT_NDF)                        : 197
rms of residuals      (FIT_STDFIT) = sqrt(WSSR/ndf)    : 0.309719
variance of residuals (reduced chisquare) = WSSR/ndf   : 0.0959262

Final set of parameters            Asymptotic Standard Error
=======================            ==========================
a               = 2046.19          +/- 0.03099      (0.001515%)
b               = 0.314157         +/- 2.62e-007    (8.339e-005%)
c               = 2.74857e-005     +/- 0.03098      (1.127e+005%)

correlation matrix of the fit parameters:
                a      b      c     
a               1.000
b               0.036  1.000
c              -0.001 -0.017  1.000
gnuplot>


--- End code ---

Navigation

[0] Message Index

[#] Next page

[*] Previous page

There was an error while thanking
Thanking...
Go to full version
Powered by SMFPacks Advanced Attachments Uploader Mod