The goal
I would like to know how to connect a transistor (MOSFET) to a capacitive load. I would like to rapidly charge and discharge a capacitor.
How do I do it correctly? I basically want the transistor to work as a mechanical switch.
What I have tried so far
I have tried the following circuit, but for some reason, VDS (voltage, drain-source) is always zero. Here VDS = V_cap (Voltage over the capacitor)
Here is a transient analysis:
The issue:
As you can see VDS is always zero. I expect it to be alternating.
Additional Material
EDIT:
As suggested, putting a small Resistor (here I put 10Ohms) in parallel solves the issue:
… but I don't understand why? Wouldn't we have a floating node if the transistor is open?
Best Answer
To observe a VDS of 5V you must have some way of reducing the voltage across the capacitor to zero. Your circuit has no path for current flow to accomplish that. Try putting a resistor in parallel with the capacitor and you should see VDS change.