# How to model a complex frequency-dependent impedance in LTSpice?

I am looking for a way to model a frequency-dependent impedance in LTSpice, optimally for a transient analysis.

I have the algebraic expression for the impedance: $$Z = j\cdot tan({k \cdot t \over p})$$ with $$\k = \omega \cdot {{1-j \cdot g} \over v}\$$ where ω is the angular frequency and t, p, g and v are some real constants.

Right now, I divided the expression into a real and an imaginary part and have a resistor and an inductor for them respectively, and use $$\{\small L} = {{Im(Z)} \over \omega}\$$ as the inductance.

But I have no real frequency dependence since in the expression for the resistance and inductance I use the frequency f as a parameter and have a sinusoidal voltage source with this frequency as an input. This is insufficient, since I need to have some PWL as a source in the end.

I have seen that usually frequency-dependent impedances are modeled via a Laplace transformation with current-controlled voltage or current sources. There, the j is absorbed in s = jω and thus I can not divide by ω as before. Also, I read that the Laplace transformation should not be used with transient analysis.

Edit: I found a way to implement it with the laplace function, but is there any way to do it suitable for transient analysis? I want to give a PWL as input signal.

• The point is that I do not have a linear dependence on the frequency only as it is with sL. The real and imaginary parts of my impedance should be: Re(Z)=sinh(gwt/v) / (cosh(gwt/v)+cos(wt/v)), Im(z)= sin(wt/v) / (cosh(gwt/v)+cos(w*t/v)). So the frequency-dependence is in the sin, cos. Dec 1, 2021 at 9:51
• Oh, sorry I missed the edited body with better formatting. Alright then. I'm deleting my silly comment. Dec 1, 2021 at 9:52
• But thanks for giving an answer Dec 1, 2021 at 11:15
• +1 This would enable a proper simulation of ferrite bead filters. Dec 1, 2021 at 12:22
• What do you mean by that, Tobalt? That it is not possible? Dec 1, 2021 at 16:07

The problem is that your transfer function is very complex, and when I say complex, I mean that both the real and the imaginary parts are functions of $$\\exp(x)\$$. If this was only about .AC this was no problem: just make a Laplace expression out of it and it will work flawlessly. But if you need .TRAN, Laplace expressions are very finicky. One thing they need in order to function at least close to normal is a pole at high frequencies. You could add one beyond the bandwidth of interest, since this is a highpass response of some sort. But if you can't then your only other option is to try to approximate the response with RLC(G) elements. And for this expression, not only it will not be easy, but it will be just that: an approximation.

I just tried to make an example but it failed with: The Laplacian is singular at 302.638 Hz (for t, p, g, v having the values 1, 2, 3, 4). If I use $$\\omega=j2\pi f\$$ (not just $$\2\pi f\$$), it fails with the same message but at 904.221 Hz. Sure, my values are completely bogus but, provided your values don't get you in this mess, and that you're willing to bite the bullet with the Laplace expression, you could use a VCVS/VCCS with this:

Laplace=sqrt(-1)*tan(s/sqrt(-1)/v/p*(1-sqrt(-1)*g)*t)/(s/1meg+1)**2


That (s/1meg+1)**2 is a double pole at ~160 kHz to ensure the fall-off at high frequency. I'm not saying it will work, I'm saying it will work better than without the pole (when you're likely to see some very strange results). If you feel adventurous, use the nfft, mtol, and the window parameters, as descibed in the help (LTspice > Circuit Elements > E> ...). You can see how to use them by checking the Examples/PLL.asc and Examples/PLL2.asc.

• Thank you for this suggestions. When trying to do a .tran with the laplace and a sinusoidal input voltage I don't even get to the point of strange behavior but get the error message 'Laplacian is singular at DC'. Thereby, it does not matter whether I expressed j as s/abs(s) or sqrt(-1). I use a VCCS. What exactly did you use for that example? Dec 1, 2021 at 15:57
• Also a follow up question to the Laplace: For the VCCS the value I give is the transconductance g, right? So why isn't is Laplace=1/Z? Dec 1, 2021 at 16:05
• @a_member As I said: "I tried making an example but failed". Then I continued: "in case your values don't get you this mess...". So I couldn't do it, either, and it's up to you to verify that whatever formula you have there is not a pathological case. But, as I see it, you have a tangent, so you'll end up with a discontinuity. Did you mean atan()? I'm not sure I understand this: "So why isn't is Laplace=1/Z". If you want it to behave like a resistor or impedance, you need to connect it like this. Dec 1, 2021 at 17:53
• Thank you, also for the example. I just wanted to make sure I understood you correctly. Dec 2, 2021 at 9:04