## Coherent re-sampling

Started by 9 months ago4 replieslatest reply 9 months ago145 views

Hi everyone,

I have the following problem.

I have a Verilog AMS block which generates a coherent sinewave with frequency 1000137329.101562 Hz, at 10 GHz rate stored in 131072 points. With this configuration I have 13109 cycles.

This sinewave has periodic 31 consecutive noisy samples with duration 100 fs each, and I would like to see the effect of these "errors" by doing the FFT indeed.To do so, I'm re-sampling the sinewave with a faster clock in my testbench, using the following expression:

fs = fin*Nfft/Ncycles = 1000137329.101562 * 131072/13 = 10083846153846.15 Hz

but I always have spectral leakage. Below I show the waveforms without errors, sampled with this fast clock and it looks like there are more than 13 cycles, would you agree with me?

waveforms.PNG

To make it work I think, without rerunning the simulation, I should use Ncycle = 11 (to be coprime with 131072), truncate the waveforms above and interpolate to make them long 131072, would that work? Is there anything I am missing here?

Thanks to everyone!

[ - ]
Reply by March 13, 2022

Have you considered windowing prior to the FFT? This will minimize the spectral leakage at the expense of widening the main lobe (frequency selectivity). Given you have a single tone, that should not be an issue.

[ - ]
Reply by March 14, 2022

Yes I tried, and it improves a bit but far from coeherent spectrum

[ - ]
Reply by March 14, 2022

First your 10GH and then 10,000 GHz are a bit scary.

The only way to get no fft bin leakage is to choose your frequency to be exact integer number of samples per cycle. Then apply fft for one cycle length or multiple cycles.

your current scary figures imply F = 10e9/1000137329.101562 =  9.9986 samples/cycle.

If you adjust F to be 1GH then you get 10 samples/cycle and you are done.

[ - ]
Reply by March 14, 2022

If you are sure (or somewhat sure) of the frequency of  the perturbating signal you can, before doing the FFT, translate in frequency by premutiplying by a compex sinusoid of adequate freq,  in order to place the perturbation peak on one of the bin of the FFT.  And if you are not quite sure of the frequeny you can, as suggested, permorm also a windowing which will help you to adjuste in a small number of tries this 'carrier' frequeny (by seeking a maximum magnitude of the obtained _and/or a symetry if you adjust also the pahse of this carrier).