# RC circuit equations

I've been presented with the following circuit and asked to find an expression for Vc in terms of time

My working is this:

$$V_S = V_R + V_C\\ I_R = I_C\\$$

$$\frac{V_R}R = C\frac{dV_C}{dt}\\ \frac{V_S - V_C}R = C\frac{dV_C}{dt}\\ dt = \frac{RC}{V_S - V_C}dV_C\\$$ integrating $$t = -RC\ln(V_S - V_C)\\ \frac{-t}{RC} = \ln(V_S - V_C)\\$$ taking exponentials $$\exp(\frac{-t}{RC}) = V_S - V_C\\ V_C = V_S - \exp(\frac{-t}{RC})$$

But I know the answer should be $$V_C = V_S - V_S\exp(\frac{-t}{RC})$$

Can anyone see where my missing Vs has gone?

• You've forgotten the constant of integration. – Chu May 21 '17 at 17:11
• $ln(V_s-V_c)=\frac{-t}{RC}+K$ – Chu May 21 '17 at 17:19

\begin{align*} I_R &= \frac{V_R}{R} = \frac{V_S-V_C}{R}\\ I_C &= C\cdot\frac{\textrm{d}V_C}{\textrm{d}t}\\ \textrm{when }I_R\textrm{ is positive, d}&V_C\textrm{ is also positive}\\\\ &\therefore I_R = I_C\\\\\\\\ \frac{V_S-V_C}{R} &= C\cdot\frac{\textrm{d}V_C}{\textrm{d}t} \\\\ \textrm{d} t&=\frac{R \:C}{V_S-V_C}\:\:\textrm{d}V_C \\\\ \int \textrm{d} t&=-R\: C\int \frac{\textrm{d}V_C}{V_C-V_S}\\\\ \textrm{setting }u=V_C-V_S,\quad &\therefore \textrm{d}u=\textrm{d}V_C\\\\ \int \textrm{d} t&=-R\: C\int \frac{\textrm{d}u}{u}\\\\ t+C_0&=-R\:C\:\operatorname{ln}\left(u\right)\\\\ -\frac{t}{R\:C\:}-\frac{C_0}{R\:C\:}&=\operatorname{ln}\left(V_C-V_S\right)\\\\ e^{\frac{-t}{R\:C\:}}\cdot e^{\frac{-C_0}{R\:C\:}}&=V_C-V_S\\\\ A_0\cdot e^{\frac{-t}{R\:C\:}}&=V_C-V_S\\\\ \textrm{from the initial conditions at }t=0\textrm{ and }V_C&=0,\textrm{ we know }A_0=-V_S\\\\ \therefore -V_S\cdot e^{-\frac{t}{R\:C\:}}&=V_C-V_S\\\\ V_S-V_S\cdot e^{\frac{-t}{R\:C\:}}&=V_C\\\\ V_C&=V_S\cdot\left(1- e^{\frac{-t}{R\:C\:}}\right) \end{align*}
• @ACarter Yeah. That pesky $C_0$ above. I think most of us have been bitten by rushing forward and forgetting a constant of integration. (Sometimes, one gets lucky and the fact that it was missed doesn't seem to hinder the result.) – jonk May 21 '17 at 20:31