I am testing the THD at the output of a pure sine wave voltage source and am getting the following result, but I expected 0% THD.
Can anybody tell me why I get this result?
Thank you in advance for your insights!
N-Period=1
Fourier components of V(tst)
DC component:4.97553e-005
Harmonic Frequency Fourier Normalized Phase Normalized
Number [Hz] Component Component [degree] Phase [deg]
1 2.000e+04 9.934e-01 1.000e+00 0.10° 0.00°
2 4.000e+04 9.921e-05 9.986e-05 96.29° 96.19°
3 6.000e+04 6.657e-03 6.701e-03 -162.99° -163.09°
4 8.000e+04 9.831e-05 9.896e-05 102.57° 102.48°
5 1.000e+05 1.772e-03 1.784e-03 -131.09° -131.19°
6 1.200e+05 9.683e-05 9.747e-05 108.82° 108.73°
7 1.400e+05 1.750e-03 1.762e-03 -112.93° -113.03°
8 1.600e+05 9.480e-05 9.543e-05 115.03° 114.93°
9 1.800e+05 2.028e-03 2.042e-03 -88.61° -88.71°
Total Harmonic Distortion: 0.744260%(0.822770%)
Can anybody tell me why I get this result?
Thank you in advance for your insights!
N-Period=1
Fourier components of V(tst)
DC component:4.97553e-005
Harmonic Frequency Fourier Normalized Phase Normalized
Number [Hz] Component Component [degree] Phase [deg]
1 2.000e+04 9.934e-01 1.000e+00 0.10° 0.00°
2 4.000e+04 9.921e-05 9.986e-05 96.29° 96.19°
3 6.000e+04 6.657e-03 6.701e-03 -162.99° -163.09°
4 8.000e+04 9.831e-05 9.896e-05 102.57° 102.48°
5 1.000e+05 1.772e-03 1.784e-03 -131.09° -131.19°
6 1.200e+05 9.683e-05 9.747e-05 108.82° 108.73°
7 1.400e+05 1.750e-03 1.762e-03 -112.93° -113.03°
8 1.600e+05 9.480e-05 9.543e-05 115.03° 114.93°
9 1.800e+05 2.028e-03 2.042e-03 -88.61° -88.71°
Total Harmonic Distortion: 0.744260%(0.822770%)
Attachments
I am answering my own question, I found that setting the "Maximum Timestep" in the transient analysis directive solved the problem, here is the entire directive that gives good results now:
.tran 0 .01 0 1E-7
.tran 0 .01 0 1E-7
In your second post, the distortion goes down to 0.108709%(0.118400%)
Here is a way to get it down to 0.000306%(0.000000%):

View attachment Test.asc
You can trade off accuracy with speed of simulation. For example, if .param fff=2**20, THD=0.000001%(0.008777%), but the simulation takes longer to run. With more complicated circuits this does become an issue.
Have fun.
Here is a way to get it down to 0.000306%(0.000000%):

View attachment Test.asc
You can trade off accuracy with speed of simulation. For example, if .param fff=2**20, THD=0.000001%(0.008777%), but the simulation takes longer to run. With more complicated circuits this does become an issue.
Have fun.
Last edited:
I forgot to disable compression and force LTspice to use double precision with .options plotwinsize=0 numdgt=7.
Here's a version showing distortion THD=0.000000%(0.000000%)

View attachment Test2.asc
Here's a version showing distortion THD=0.000000%(0.000000%)

View attachment Test2.asc