A capacitor charging to an applied voltage can be modeled by the following equation.
V(t)=V0(1−eτ−t)
where τ is the time constant RC .
Likewise, a capacitor discharging can be modeled as follows.
V(t)=V0(eτ−t)
In terms of a piece-wise constant input, we can use the two equations to model the discharging and charging of the capacitors if we are given some initial conditions.
Solutions for General Input Functions
Given the general input function
dtdV(t)=−λV(t)−λu(iΔ)
where u(iΔ) is a constant, the value of the input function at t=iΔ, we have a solution.