LTSPICE is offering good capabilities for distortion analysis and simulations. All you have to do is to run transient analysis and then right click on the signal plot and use FFT command from view section of submenu. Or use .FOUR command and look for results in SPICE error LOG file from View menu. Though, you have to change a couple of default settings to be able to simulate and analyze harmonics, lower than – 60dB.
I was really surprised, when tried to use FFT analysis to evaluate nonlinear distortions of one of my circuits. The circuit showed unexpectedly low performance. It just could not be that bad. So, I decided to check distortions of voltage source itself. I put voltage source in the schematic and tried to measure it’s harmonics by using both FFT command and dot FOUR. Here is what I got:
I used Maximum Timestep of 1uS to get predictable time resolution, not overridden by nobody knows what autotimestep.
No Windowing function was used because 10mS corresponds to integer numbers of 1KHz periods.
Quite discouraging results, taking into account that it is just signal source and I was looking for distortions simulations, capable of analyzing at least -130dB.
I started to look for solution. First thought was to increase time resolution by decreasing Maximum Timestep to 10nS.
Well, this is much better, but that small number of Maximum Timestep could cause very long simulation time of complex circuits.
Let’s see what else could be done to improve resolution while, may be, using bigger timestep to speedup simulation.
LTSPICE control panel has a special section, dedicated to data compression. Intuitively, I felt that this may be related to resolution of FFT, because we are speaking about big range of data representation. 200dB represents data ratio of 10000000000 and this is very demanding requirement. Help describes this compression as: “LTspice compresses the raw data files as they are generated. A compressed file can be 50 times smaller than the un-compressed one. This is a lossy compression.”
After disabling compression and restoring max timestep to original 1uS the simulation looks like:
The main drawback of disabling compression through control panel is that you have to do this every time you are restarting LTSPICE.
More convenient way is to add .OPTIONS plotwinsize=0 to your LTSPICE schematic. In fact, I used this option to generate previous results.
So, results look very promising and are good enough for most kinds of applications. It is hard to imagine any practical and physically realizable circuit, that will have harmonics better than -160dB.
However, it is possible to improve resolution even better by switching to double precision calculations by using .OPTIONS numdgt=7. Any number more than 6 will force LTSPICE to switch to double precision math on dependent variables.
Quite impressive.
You can get even more by decreasing Maximum Timestep to 10nS, but this will significantly increase your simulation time in any practical case.
You can download LTSPICE schematic and play with this options by yourself.
23 Responses to Distortion measurements with LTSPICE