watcheshasem.blogg.se

Fft windowing
Fft windowing









Sfdr = 10*log10(Psignal/max(Pharm_max,Pnoise_max)) % Calculate SFDRį = (1:length(ss))/nfft % Frequency vector normalized to fs Thd = -10*log10(Psignal/Pharm) % Calculate THD Sndr = 10*log10(Psignal/(Pnoise+Pharm)) % Calculate SNDRĮnob = (sndr - 1.76)/6.02 % Calculate ENOB Snr = 10*log10(Psignal/Pnoise) % Calculate SNR Pharm = sum(ss(harm_bins).^2) % Power of harmonics Pnoise = PnoiseD*length(all_bins) % Total noise power PnoiseD = sum(ss(noise_bins).^2)/enbw/length(noise_bins) % Noise PSD Psignal = sum(ss(signal_bin).^2) % Signal power Noise_bins = setdiff(other_bins, harm_binsl) % Further discard the harmonic bins Harm_binsl=unique(harm_binsl) % Discard the repetitive harmonic bins

fft windowing

Harm_binsl=reshape(harm_binsl',length(harm_bins)*nb,1) % Convert matrix to array Harm_binsl = zeros(length(harm_bins),nb) % Find Harmonic leakage bins Harm_bins = round(nfft * fh) + 1 % Harmonic bins (2nd - 10th) Other_bins = setdiff(all_bins, signal_bins) % Further discard signal binsįh = (2:10)*fin/fs % Harmonic tone: (-/+m)fin + (-/+k)fsįh = abs(fh - (fh > 1/2)) % If harmonic tone fh>fs/2, it is equal to fs-fh Signal_bins = signal_bin + (-(nb-1)/2:(nb-1)/2) % Signal leakage bins Signal_bin = cycles+1 % Signal bin, Matlab array starts from 1Īll_bins = setdiff(1:nfft/2, dc_bins) % Disregard DC bins Ss = ss(1:nfft/2).*2 % Drop the redundant half but keep total power the same Ss = ss/nfft/cg % Compensate for window attenuation Ss = abs(fft(data.*w)) % FFT with windowing If (size(data,1)~= size(w,1)) % Check dimention

fft windowing

W = 0.5*(1 - cos(2*pi*(0:nfft-1)/nfft)) % Hann windowĬg = sum(w)/nfft % Normalized coherent gainĮnbw = sum(w.*w)/(sum(w)^2)*nfft % Normalized equivalent noise bandwidth

FFT WINDOWING WINDOWS

Recently, I found two posts from Nerd Rage ( Windows of Opportunity & ENBW) quite helpful, which are easier to digest.Īnd now, finally, I decide to write down my very limited understanding on FFT with windowing, focusing on characterizing the dynamic performance of ADC in Matlab. Let’s go straightforward by first looking at the Matlab script I am using to calculate the SNR/SNDR of ADC.ĭata = data(1:nfft) % Number of data to be the same as nfft Though seminal papers and reports lie on my desk for quite long time, I still feel difficult to really understand windowing. One has to go for windowing to characterize the dynamic performance of ADC.

fft windowing

Coherent sampling is quite difficult to meet under the lab conditions.









Fft windowing