Wednesday, April 21, 2010

Coherent Sampling Calculator

% Coherent sampling calculator for ADC testing
% Signal generator resolution in decimal places after MHz is
% considered to be 6 -- i.e. Resolution is 1 Hz
% See http://www.maxim-ic.com/app-notes/index.mvp/id/3190
% for details --Alper Ucar, ucar {at} ieee {dot} org
% Finc: coherent input frequency of the test signal
% Fs: coherent sampling rate
% Fs: sampling rate
% Fin: input frequency of the test signal
% N: number of samples
function[Fsc,Finc] = csr(Fs,Fin,N)

format long
N = 2^floor(log2(N));
% desired sampling window
tdw = N/Fin;
% desired FFT bin
fdb = 1/tdw;
% coherent FFT bin
fdc = round(fdb);
% coherent input frequency
Finc = round(fdc*N);
% number of input cycles in the desired sampling window
ndw = Fs/Finc*N;
% number of input cycles in the coherent sampling window
ncw = ceil((ndw+1)/2)*2-1;
% coherent sampling rate
Fsc = Finc*ncw/N;

No comments:

Post a Comment