Please bear with me since the post is a bit long. I had to run a couple of simulations before getting here.
Experiment:A sine wave of unit amplitude and frequency 100 Hz is sampled at a frequency of 2048 Hz for a period of 0.5s yielding 1024 samples. A 1024-point FFT is taken and the power spectrum is calculated from the FFT. The above experiment is performed separately in MATLAB and Cadence. The next step is to compare the power spectrum plots from Cadence and MATLAB and see if they match.
Analysis/Result:Figure 1 shows a plot of the power spectrum obtained from MATLAB. It also shows a snapshot of the signal in time domain. Bear in mind that this is simply a partial snapshot since the sampled signal is actually 0.5s long. The peak occurs at 100 Hz as expected and has a magnitude of 20.97 dBm. The noise floor is at -300 dBm.
Link to Figure1:
https://www.dropbox.com/s/bywnv0h958yovk3/Figure1_Power_Spectrum_MATLAB.pngThe above experiment was repeated in Cadence by using vsin from analogLib to generate the sinusoidal signal and setting the length of simulation time to be 0.5s, and the time step to be 488.28125 us (=1/2048 Hz). Figure 2 shows a plot of the power spectrum from Cadence. While the peak is still at 100 Hz, it has a magnitude of 29.9 dBm, a difference of 9 dBm, and the noise floor is -125 dBm. I cannot understand the reason for this difference.
Link to Figure 2:
https://www.dropbox.com/s/2vrtjtjs5rp6my3/Figure2_Power_Spectrum_Cadence.pngSince the plots do not match, I imported the data generated by vsin as a .csv file into MATLAB and plotted the FFT (Figure 3). The MATLAB plot continues to show a peak of 20.97 dBm and the noise floor is lower than Cadence.
Link to Figure 3:
https://www.dropbox.com/s/eehbywfcs2i5ldz/Figure3_Power_Spectrum_imported_into_m...Could someone comment why the MATLAB DFT and Cadence DFT give different results even though I feed the same data to both the functions ?On a minor note, could someone tell how to post images inline, or at least to attach multiple images in a single post ???