# LTSpice capacitance dependend on voltage source

I am looking for a way to change the value of a capacitance dependent on the voltage source of the circuit.

How do I create a voltage dependent capacitor in LT spice?

Edit: Two capacitances in a row are connected to a voltage source. The voltage source has a defined slope of the voltage. One capacitance shall be dependend (nonlinear) on the current voltage that the voltage source outputs. Example:::: Voltage (Power supply)= 200V -> Capacitor_1 = 10uF :::: Voltage (Power supply)= 400V -> Capacitor_1 = 1uF

• What methods have you found so far and, importantly, what is your question? – Andy aka Jun 19 '18 at 9:35
• Are you looking for a voltage dependent capacitor? Not clear what is the voltage source of the circuit and I am sure that it is not a general name. – Horror Vacui Jun 19 '18 at 11:23
• I know that I can change the Cap with .step param, but then ltspice outputs various simulations of the steps. What I have is this: Two capacitances in a row are connected to a voltage source. The voltage source has a defined slope of the voltage. One capacitance shall be dependend (nonlinear) on the current voltage that the voltage source outputs. Example:::: Voltage (Power supply)= 200V -> Capacitor_1 = 10uF :::: Voltage (Power supply)= 400V -> Capacitor_1 = 1uF – soderdaen Jun 19 '18 at 13:41
The behavioural elements include, besides the voltage and current, resistor, inductor, and capacitor. If you ran a quick search through the manual you would have found out quicker than it would have taken you to ask here: LTspice > Circuit Elements > C, bottom. Simply place a capacitor and add Q=<...> as the value. If the formula includes x, that signifies a derivative of the current, so your expression needs to be integrated first -- unless you don't need x, it can be done, for example external voltage, in your case.
So, for example, if you want your capacitance to vary according to $\sin x$, then you have to integrate that first, which gives you $-cos x$:
See the expression is -cos(x), whre x is the derivative of the current. The driving voltage is a unity ramp, which means the current through the capacitor is directly its value (I(C1)). The behavioural voltage is for confirmation, V(test), which shows the same sine. Here, for reasons of clarity, I avoided dividing by 2$\pi$, so that the current has a different amplitude; had I not, the current and the voltage would have overlapped and it would not have been clear.