I came across this question in my assignment:

enter image description here

Initially, the question seemed very absurd, but anyways i applied kirchhoff's voltage law and got

$$V_c = 10V$$

But Since we all know that: $$i_c = C\frac{dV_c}{dt}$$ $$\Rightarrow i_c=0$$

Seems quite okay because since the time constant of the circuit is zero, it would charge up almost instantly and thus behave like an open circuit

However, when i plot the same ciruit in Ltspice , the i vs t graph is quite different : enter image description here

I have no idea how the above graph came about. Can anyone explain why the simulator gave the above graph ?


  • 1
    \$\begingroup\$ The circuit you drew by hand is a nonsense circuit. You can not analyze a situation where you connect a capacitor charge to one voltage to a voltage source at a different voltage. At the instant of connection, this circuit violates KVL and the resulting current will be infinite. This gives numerical nonsense. \$\endgroup\$ Commented Apr 4, 2020 at 13:32

4 Answers 4


Besides what the others have already answered, you're simulating the apparent charging of a 10uF capacitor on a million seconds time scale. That doesn't seem to be a thoughtful decision.

Additionally, you should know that by using the simulation card that you're using, means that LTspice will first try to find a solution to the circuit, so that when you hit "run", it would appear as if the circuit has been running since the Big-Bang, and only now you are seeing the effects of a circuit that has had plenty of time to settle, resolve any transients, and looks as it is in your picture.

That is unless you use a pulsed source, or the startup flag, or the uic:

  • with a pulsed source (e.g. from 0 to 1 V), you're manually telling the solver that the circuit was at rest, and you want to dictate the time when a change is happenning. The same reasoning applies here, too, as above, the circuit has been runing since forever, but it was zero.
  • with startup, LTspice will decide to ramp up the sources right at the beginning, which is about the same as above but handled by LTspice. Here, too, the circuit has been running since the dawn of time.
  • and with uic you're telling the solver to forget anything that might have happened before, and consider that the Big-Bang happens when you click "run", so it will have to calculate all the possible transients.

Since it's a simulator that runs on a computer, numerical tolerances play a great part, which means that the voltage source cannot have 0.0 internal resistance, becaue it would generate division by zero. Therefore it would have a finite amount of resistance which, together with the solver, try to compute numbers that would be as close to reality as possible. That 0.01 fA current translates into the 1e-17 range, which is around the double precision, and it's, most probably, the residual after the Newton-Raphson iteration (or its alternatives).

In addition, the graph looks bent at both ends because of the relative huge timestep and because of waveform compression (default, on). You could circumvent these by setting a smaller timescale (us...ms seems beter suited), an optional timestep, and an even more optional .opt plotwinsize=0, which disables waveform compression, leaving the waveforms artifact-free. Or use the alternate solver, which is much more precise, but about twice as slow.

  • \$\begingroup\$ Just realized I forgot to add the 4th bullet with individual ic=<...>, or per node .ic, but those behave similar to startup, but with more control, and then I would have had to also mention the behavioural source, but which sort of falls in the 1st bullet category, and... as it is it conveys the message. \$\endgroup\$ Commented Apr 4, 2020 at 17:25

Your simulation is meaningless: You're taking a ideal voltage source, which can supply an infinite amount of current if necessary, and connecting it to an ideal capacitor, which has no internal resistance, only capacitance.

So, in your simulation, the voltage source immediately charges the capacitor to full voltage (that happens in a single simulation time step), and then has zero current.

Whatever that simulation says hence has nothing to do with reality!

Notice how the unit is 0.01 fA on the y-axis? yeah, that's probably a numerical error somewhere.

  • \$\begingroup\$ Yes. This is the answer. Connecting a capacitor, charged to one voltage value, in parallel with a voltage source of another value, is a nonsensical circuit. \$\endgroup\$ Commented Apr 4, 2020 at 13:30

Your simulation results (for your configuration) is correct. Your capacitor is already charged and you have a fluctuation of what, \$1^{-17}A\$? Probably it comes from the simulation tolerances.

See, since you are not simulating the switching behavior of your switch (it is also another option), you have to instruct LTSpice to consider all external sources to 0, meaning that \$V_{CAP}=0V @ t=0\$.



Just tried that simulation with the same results. There are two issues here.

1) The apparent time delay with the current appearing to ramp from 0.01000000fA to 0.01000018fA is due to the time step being used. To fix this either add a maximum time-step say (1ms) to your simulation or simulate over a shorter time.

2) 0.01fA \$(10 \times10^{-18}\text{amp}) \$ is tiny. Assuming ideal components an infinite current would flow in zero time to charge the capacitor then the current is zero, Spice is a numerical approximation so the answer will always have some error. In the real world the current would be limited by the ESR of the capacitor and the output impedance of the PSU so would charge in a finite but short time.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.