0
$\begingroup$

I am calculating the standard deviation of skew (= phase/2*pi*fin) from the 1000 monte carlo runs of the following code.

In the y0, there is no input skew., but in y1 there is a skew present. Its this skew that i am measuring at the output of the FFT through phase diffrence calculation.


mc=1000; % Monte carlo

clear spur_db_vector;
clear Ydb_with_filter;
clear Y;
clear y;
clear variation_input_db_y0;
clear variation_input_db_y1;
clear variation_input_phase_y0;
clear variation_input_phase_y1;
clear  skew_ps;

for m=1:mc

Fs=100e6;   % sampling frequency changed depending on the individual ADCs
Ts=1/Fs;
NFFT=2^12;
Runtime=(NFFT-1)*Ts;
t=0:Ts:Runtime;       % signal directly sampled at 100 MHz 
y=zeros(1,length(t));

% Gain
g=1; 

% input frequency indexing

input_wanted=40.5*1e6; % INPUT FREQUNECY tone
factor=Fs/NFFT;
bin=round(input_wanted/factor);
fin=bin*factor;
fin_MHz=fin/1e6;

do=[0 0];

dg=[0 0];

dt=[0 100e-12];   % skew  given to y1

g_k1=1;
g_k2=1;
dphase1=0;
dphase2=0;


SNR=53

%Noise Calculation

SNR_linear=10^(-SNR/10);
noise_power_linear=SNR_linear;

SD=sqrt(noise_power_linear);
noise0=randn(1,NFFT)*SD;
noise1=randn(1,NFFT)*SD;



% % %Time Domain Signals with thier offsets
y0=(g+dg(1)).*g_k1.*cos(2*pi*fin*(t+dt(1))+dphase1)+do(1)+noise0;
y1=(g+dg(2)).*g_k2.*cos(2*pi*fin*(t+dt(2))+dphase2)+do(2)+noise1; %both time axis are same


% Calculate Spectrum of y0
Y0 = fft(y0,NFFT)/NFFT;
Ydb0 = 20*log10(abs(Y0(1:NFFT))) + 6.02; %  db added for folding of energy from the negative axis spectrum


% Calculate Spectrum of y1
Y1 = fft(y1,NFFT)/NFFT;
Ydb1 = 20*log10(abs(Y1(1:NFFT))) + 6.02;  %db added for folding of energy from the negative axis spectrum



input_fft_index=round(input_wanted/factor)+1 ;

variation_input_db_y0 (m) = Ydb0(input_fft_index) ;
variation_input_db_y1 (m) = Ydb1(input_fft_index) ;

variation_input_phase_y0 (m) = angle(Y0(input_fft_index)) ;
variation_input_phase_y1 (m) = angle(Y1(input_fft_index)) ;


end


phase_difference_vector=variation_input_phase_y1-variation_input_phase_y0;
skew_vector=phase_difference_vector.*1e12./(2*pi*fin);
SD_skew=std(skew_vector)

My question is . .why is standard deviation of the skew (SD_skew) different at different frequencies input (input_wanted).. and why is it dependent on NFFT number as well ?

Shouldn't it remain constant ? Its smaller at higher input frequencies

Thanks

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.