# How can I calculate complex values in LTSpice?

I am trying to implement a circuit which contains some complex number of form:

$$x + jy$$

So my question is how to represent complex value while writing netlist in LTSPICE.

• Impedance is a complex number typified by an inductor or capacitor in series with R. Oct 25, 2016 at 15:37

If you need calculations as result of formulas, then using active elements will not be a solution. If so, then you're partly out of luck because LTspice doesn't support complex numbers, except in .AC analysis in the waveform arithmetic. Partly, because the only way of doing it is to manually decompose your results into real and imaginary parts (e.g. Euler's formula: exp(i*x) = cos(x) + i*sin(x)). It gets complicated, yes, but you can even do FFT in time domain, provided your input is real-valued, only (I did it, but only as a test, because of the immense impact it has for higher N, as you can imagine). The trick is to avoid any calculations that can result in a direct a+i*b result, because the b will be lost. Only careful separation of terms will give you correct results. I even managed to calculate elliptic filter's roots this way, and not by following the simplified way, but by using real sn()&co (which were approximated with theta functions). Which means there's hope, but only so much.