The Designer's Guide Community Forum
https://designers-guide.org/forum/YaBB.pl
Simulators >> Circuit Simulators >> THD calculation using waveform calculator
https://designers-guide.org/forum/YaBB.pl?num=1144940007

Message started by vivkr on Apr 13th, 2006, 7:53am

Title: THD calculation using waveform calculator
Post by vivkr on Apr 13th, 2006, 7:53am

Hi,

I get a disturbing result if I use the THD function in the waveform calculator.

I was looking at the spectrum obtained from a DFT of my output and could see no
tones above ~-110 dBFS with respect to the fundamental. However, when I just
keyed in the THD function to see what the overall distortion was, I got -60 dB
as the THD.

I don't quite understand this. I did do undersampling in this wideband S&H simulation,
but I specified the carrier as '0' which is supposed to automatically look for the largest
signal in the span and select it as the fundamental.

The output is strobed and I provide the same set of samples to the THD function that I
passed on to my DFT function, and the results are so different.

Although I do not really believe the THD figure, I would like to know if anyone is
aware of this problem, and a way to fix it.

Thanks
Vivek

Title: Re: THD calculation using waveform calculator
Post by sheldon on Apr 16th, 2006, 8:13pm

Vivek,

  Could you provide some additional information:
1) Testbench setup: input frequency, sampling frequency
2) DFT setup
3) THD measurement setup

                                       Best Regards,

                                           Sheldon

Title: Re: THD calculation using waveform calculator
Post by vivkr on Apr 18th, 2006, 3:26am

Dear Sheldon,

This is the setup I used.

Signals:

Fin=701 kHz (Sine)
Fs=1024 kHz

FFT Setup/THD Setup:

Window: Rectangular (Coherent sampling used, hence no windowing was needed)
Nfft=4096

I see a very clean output spectrum, with the peak signal level around (Fs-Fin). The next
spur is -110 dB below this, and the remaining spurs, all of which are clearly visible due to
coherent sampling are even lower, typically at -130 dB below the peak.

To plot the FFT, I load the output expression in Waveform Calulator, and then define the FFT
expression. For THD, I do exactly the same (same set of output samples, window etc.), and let
the calculator find the peak tone by itself. Even when I explicitly provide the location of the
peak signal, the result remains the same.

Regards
Vivek

Title: Re: THD calculation using waveform calculator
Post by sheldon on Apr 22nd, 2006, 9:23pm

Vivek,

  In your case, the standard calculator THD function is not the appropriate
tool to evaluate the THD for your circuit. Doing a hand calculation, the tones
are located at the following frequencies

Fundamental ( 1024kHz - 701 kHz)           = 323kHz
Second harmonic ( 1402kHz - 1024kHz)   = 378kHz
Third harmonic ( 2103 kHz - 2048kHz)     = 55kHz

The THD function is intended for applications where the harmonics are at
integer multiples of the fundamental frequency, such as audio amplifiers.
That is the tones are at f1, 2xf1, 3xf1, ...

Sampling is folding the frequencies and as a result the distortion does
not occur at the frequencies the THD function expects. In this case,
it is probably easier to manually build the THD function using the
calculator, use the value function to grab the individual tones.

THD = sqrt((2f1^2+3f1^2+...)/f1^2) and convert to percent

                                                        Best Regards,

                                                            Sheldon

 

Title: Re: THD calculation using waveform calculator
Post by vivkr on Apr 24th, 2006, 5:31am

Hi Sheldon,

Thanks for the tip. I was under the impression that the calculator would work correctly if
I set the option '0' instead of providing it a fundamental frequency. The doc says that this automatically
selects the largest tone as the fundamental. I had also tried to key in 'fs-fin' as the fundamental but that too gave
exactly the same incorrect figure.

Nonetheless, the approach you suggest should help me get rid of these issues.

Regards
Vivek

The Designer's Guide Community Forum » Powered by YaBB 2.2.2!
YaBB © 2000-2008. All Rights Reserved.