This is an old revision of the document!
DRAFT
Simulating a time-varying capacitor in Spice
The current-voltage characteristic of a capacitor $C_1$ is given by:
$$ I_1=C_1 \frac{dV_1}{dt}$$
with $I_1$ and $V_1$ the current through and the voltage over the capacitor $C_1$.
We multiply this equation with a time-varying function k(t):
$$ k(t).I_1= [k(t).C_1] \frac{dV_1}{dt}$$
Suppose we want we simulate a time-varying capacitor, e.g., a sinusoidal value in function of time with a certain offset: C(t)= 5 µF + 3 µF.sin(2π.10.t).
This can be realized by introducing an independent voltage source with voltage equal to the requested value of the resistor, i.e. 1 V corresponds to 1 Ω. Thus for our example, we need to introduce a voltage source with DC offset 5V, amplitude 3V and frequency 10 Hz. We allocate a label to the output of the voltage source, e.g., output
.
Next, we label the value of the time-varying resistor R1 as R=V(output)
. As a result, the value of the resistor wil be identical to the output of the voltage source, as can be seen in the following figure.
Notice that we can plot the value of the resistor by choosing V(V1)/I(R1)
as plot function.
References