Capacitor Charging / Discharging: Program 1
ODE for Capacitor Charging and Discharging
The voltage across a capacitor V(t) in an RC circuit can be described by the following ODE:
Charging:
dV(t)/dt = (1/RC) * (Vin - V(t))
Discharging:
dV(t)/dt = -V(t)/(RC)
Here:
- V(t) is the voltage across the capacitor at time t.
- Vin is the input voltage (for charging).
- R is the resistance in ohms.
- C is the capacitance in farads.