The Designer's Guide Community
Forum
Welcome, Guest. Please Login or Register. Please follow the Forum guidelines.
May 26th, 2019, 7:07am
Pages: 1
Send Topic Print
MATLAB DFT vs Cadence DFT (Read 9923 times)
Sharath Raju
Junior Member
**
Offline



Posts: 13

MATLAB DFT vs Cadence DFT
Oct 23rd, 2012, 11:29pm
 
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.png

The 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.png

Since 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 ??? Sad
Back to top
 
 
View Profile WWW   IP Logged
Ken Kundert
Global Moderator
*****
Offline



Posts: 2166
Silicon Valley
Re: MATLAB DFT vs Cadence DFT
Reply #1 - Oct 24th, 2012, 4:57pm
 
1 Vp corresponds to 30dBm? Is your reference impedance 500mΩ?
Back to top
 
 
View Profile WWW   IP Logged
Sharath Raju
Junior Member
**
Offline



Posts: 13

Re: MATLAB DFT vs Cadence DFT
Reply #2 - Oct 24th, 2012, 6:26pm
 
Hi Ken,

Thanks for the reply. The load impedance in my testbench is 1 kilo-ohm. I changed it to 50 ohm, bwut didn't see any difference in the power spectrum. (The peak tone continues to have a magnitude of 30 dBm and the noise floor is approximately -125 dBm).

Snapshot of testbench: https://www.dropbox.com/s/lqkaieyf2kc152o/Power_Spectrum_Cadence_Testbench.png

Thanks,
Sharath
Back to top
 
 
View Profile WWW   IP Logged
Ken Kundert
Global Moderator
*****
Offline



Posts: 2166
Silicon Valley
Re: MATLAB DFT vs Cadence DFT
Reply #3 - Oct 24th, 2012, 11:28pm
 
1 Vp with a 1kΩ reference resistance is -3 dBm. So your first step is to understand why both approaches are giving you the wrong power at the fundamental frequency.

-Ken
Back to top
 
 
View Profile WWW   IP Logged
rfidea
Senior Member
****
Offline



Posts: 159
Europe
Re: MATLAB DFT vs Cadence DFT
Reply #4 - Oct 25th, 2012, 9:42am
 
What is causing your dft plots to be in dBm? You are talking about volts in the text. How is the conversion done?
Back to top
 
 
View Profile   IP Logged
Sharath Raju
Junior Member
**
Offline



Posts: 13

Re: MATLAB DFT vs Cadence DFT
Reply #5 - Oct 25th, 2012, 11:00am
 
The conversion to dBm is done as follows:
Power in dBm = 20*log10(abs(Xk)) + 30
where,
Xk = FFT of x
x = voltage input.

The factor 30 causes the power to be in dBm. Otherwise, it would be in dB.

Thanks
Back to top
 
 
View Profile WWW   IP Logged
Ken Kundert
Global Moderator
*****
Offline



Posts: 2166
Silicon Valley
Re: MATLAB DFT vs Cadence DFT
Reply #6 - Oct 25th, 2012, 11:54am
 
dBm is decibels relative to 1mW. To convert voltage to dBm you need to know the load resistance, which is generally referred to as the reference resistance. The formula is

dBm = 30 + 10 log(Vp2/(2R))

where the voltage is assumed to be sinusoidal with a peak value of Vp. R is the reference resistance.

I don't know how you are calculating dBm in Matlab (because even with your equation 1Vp does not correspond to 20 dBm), but I am pretty sure that ADE would be using the formula I gave above, but you would have to specify a value for the reference resistance.

-Ken
Back to top
 
 
View Profile WWW   IP Logged
Pages: 1
Send Topic Print
Copyright 2002-2019 Designer’s Guide Consulting, Inc. Designer’s Guide® is a registered trademark of Designer’s Guide Consulting, Inc. All rights reserved. Send comments or questions to editor@designers-guide.org. Consider submitting a paper or model.