# Simulating (transient) intermodulation distortion

I'm designing an audio amplifier and I'm trying to simulate and measure all the characteristic features of it (output power, offset, bandwidth, input/output impedances, etc.).

However, I don't know how to measure intermodulation distortion (IMD) or transient intermodulation distortion (TIM).

For IMD, I've read that one should put two generators of 19 kHz and 20 kHz in series at the input, and then measure the distortion at the output. However, I believe that for IMD, one should not take into account the harmonic distortion caused by these two signals (i.e. one shouldn't interpret the appearance of 38 kHz or 40 kHz at the output as IMD, because it is THD actually). So, how can one measure IMD in LTspice then?

Apart from that, I want to simulate the TIM. But, in this case, I don't even know how to perform this measurement. Is there a way to do it?

The test you are talking about involves the harmonics generated through IMD, which appear as differences and multiples of them around the carriers and harmonics of the carriers. I would refer you to hypex.nl, where you can browse for some nice documents, to read about them.

As a schematic, here's a quick mockup in LTspice:

You can see the input is made of a voltage source, summed up with a current source (which is making use of V1's internal Rser=1), to generate a 1Vpk test signal comprised of 19kHz and a 20kHz sines. The runtime is set to be a multiple of their difference, 20kHz - 19kHz = 1kHz => 1ms period. Here, 16ms. In addition, the almost mandatory plotwinsize and numdgt settings and a timestep of 1/2^10/f, for a binary division, even if that doesn't really matters sine LTspice a) doesn't use a true fixed timestep and b) it uses its own interpolation system, internally. But, it's good to be on the safe side.

To visualize the effects, one performs an FFT on the waveform, with these settings (as chosen here):

Note that binomial smoothing is set to 1 (disabled) and there is no wondowing applied (sharpest response). The result:

You can clearly see the IMD's effects around the two carriers. For more exotic (and bad) circuits, you can also see harmonics around the beginning of the spectrum (lower frequencies), I think there are some examples at the site I was talking about.

Maybe you could use other methods, as well, but this should be the most straight-forward and give you the clearest picture, IMHO.