# Frequency dependent capacitor for AC sweep analysis in LTspice

I need to model a frequency dependent capacitor for AC sweep analysis in LTpsice. I see that it is possible for inductors with GLAPLACE component, but I don't find anything about capacitors. The value of that capacitor, in LTspice code, is:

Cap = (1/(pow((6.28*Frequency), 2)*InducFilter))

where InducFilter is a constant.

Here is the example of a frequency dependent inductor:

Inductor example

• To undersand the capacitance formula correctly: C(f)=Co*X(f) with X(f)=1/f², correct? So the capacitance C must be prop to 1/f² ? – LvW Dec 4 '18 at 15:10
• Yes, it is derived from the equation: f = 1/(2*pi*sqrt(LC)). – FM79 Dec 4 '18 at 15:14
• Thank you for selecting the answer, but it may be best to wait a few days, maybe there will be other, better answers. – a concerned citizen Dec 4 '18 at 15:20

The example you saw in the link you provided makes use of the Laplace transfer function -- the so-called "GLAPLACE", no such thing (at least not in LTspice). Here is an example:
To the right is what's in the link, to the left is what you'd want. As you can see, the inductor (s*L) is nothing more than the reverse of the capacitor (1/(s*C)). The slopes differ because the Laplace transfer functions use sqrt(s).
Word of warning: The Laplace operator should not be used in .TRAN analysis, as it is very prone to errors and instabilities. In .AC it's perfectly fine, and extremely versatile, so you can adapt whichever Laplace transfer function you want. BTW, that's not LTspice code, you probably meant pseudo-code for your needs.
If you intend to do transient analysis, the only solutions you sould be using are the behavioural inductor (its value is of the form Flux=f(x), see the manual for more) but which is sensitive to noise (use with care), or approximate the response with a Cauer or Foster topology (or whichever homegrown network suits you).
• Also, note that I am using a voltage source for all, which forces me to evaluate the impedance to V/I. Usually, and if the circuit allows, it's much easier to use a current source, with the same AC 1, which would mean that the impedance is simply V/I=V/1=V. Here, due to the G-source, I am forced to use a path for he current to ground, so I chose the voltage source. Using a current source would have meant two current sources in parallel, that's inviting the devil in any SPICE. So I chose the same for all, for consistency. – a concerned citizen Dec 4 '18 at 17:01