I want to calculate voltage across the resistor.

enter image description here

I divided the circuit into two parts:

  1. Charging=0<t<1, 2<t<3, 5<t<6(ms)...
  2. Discharging=1<t<2,4<t<5,7<t<8(ms)...

$$ 0<t<1:charging$$ $$ V_R(t=1)=5e^{-1}=1.84$$

$$ 1<t<2(ms):Discharging$$ $$ V_R=-V_c$$ $$ V_c(t=2ms)=1.84e^{-1} =-V_R(t=2ms)$$ $$ V_R(t=2ms)=-0.67$$

Circuit in discharging time: at t=1ms voltage across the capacitor was 1.84V.

enter image description here

This is the graph I get:

enter image description here

The problem is that when I simulate this circuit at t=1ms the capacitor starts discharging from -3.137V, but from my calculation, it must start from -1.84V.

What am I doing wrong?

enter image description here


2 Answers 2


I can't say where you went wrong with your math but, in this simple example of an RC network, whenever the voltage source instantly rises to 5 volts from 0 volts or instantly falls to 0 volts from 5 volts, that "edge" passes through the capacitor as if the capacitor is 0 Ω or a short circuit.

Hence, the first time the 5 volts drops to 0 volts, the voltage that the output has decayed to then drops instantly by 5 volts. So, where you have calculated the voltage having dropped to 1.84 volts (during the first 5 volt presence of the input), the instant that voltage drops to 0 volts, the +1.84 volts must also drop instantly by 5 volts to -3.16 volts.

You have it dropping from +1.84 volts to -1.84 volts and clearly that cannot be correct because it should be a 5 volt step change; the 5 volt edge passes unhindered through the capacitor as if it were a short circuit.

  • 2
    \$\begingroup\$ Thank you, yes I did a silly mistake at t=1ms voltage across Capacitor=(5-1.84)V=3.16v,i just take 1.84v which is voltage across resistor not across capacitor. \$\endgroup\$
    – Nitish
    Commented May 18, 2022 at 16:13

Were you to solve the differential equations for this circuit, you would find that the voltage across the capacitor always is predicted by this equation: \begin{align} V_C(t) &= V_\mathrm{f} + \left( V_\mathrm{i} - V_\mathrm{f} \right) e^{-t/\tau}, \end{align} where the time is measured from some initial point—the start of each half cycle here—when its voltage is \$V_\mathrm{i}\$ and would end it at \$V_\mathrm{f}\$ if it were allowed to change smoothly through infinite time. The constant \$\tau\$ is the time constant: \$\tau=RC\$.

You can easily see that at time \$t=0\$ this equation does indeed predict \$V_C = V_\mathrm{i}\$ and at time \$t=\infty\$, \$V_C = V_\mathrm{f}\$. The voltage across the capacitor always moves toward the value of \$V_1\$, so that's the appropriate value for \$V_\mathrm{f}\$ for any interval under consideration. Of course, \$V_1\$ changes at the beginning of every half cycle. Given \$V_1\$ and \$V_C(t)\$, Kircholff's voltage law let's you compute \$V_R(t)\$:

\begin{align} V_R(t) &= V_1 - V_C(t). \end{align}

Assuming that the initial voltage across the capacitor at time \$t=0\$ is 0 V, then for the half cycle when \$V_1\$ goes high, \begin{align} V_C &= V_1\left( 1 - e^{-t/(RC)} \right) \\ V_R &= V_1 e^{-t/(RC)} . \end{align}

Since the time constant \$ \tau = RC = 1 \mathrm{~ms} \$, after this time we have

\begin{align} \Bigl. V_C(t) \Bigr|_{t=1\mathrm{~ms}} &= (5\mathrm{~V}) \left( 1 - e^{-1} \right) \\ &= 3.16\mathrm{~V} \\ \Bigl. V_R(t) \Bigr|_{t=1\mathrm{~ms}} &= (5\mathrm{~V}) e^{-1} \\ &=1.84\mathrm{~V}. \end{align}

These constitute the initial conditions for the next half cycle, but now \$V_1=0\$, so

\begin{align} V_C(t) &= (3.16\mathrm{~V}) e^{-(t-1\mathrm{~ms})/(RC)} \\ V_R(t) &= -V_C(t). \end{align}

At time \$t=2\mathrm{~ms}\$ we have \begin{align} V_C &= (3.16\mathrm{~V}) e^{-1} \\ &= 1.16\mathrm{~V}\\ V_R &= -1.16\mathrm{~V}. \end{align}

For the third half cycle, unlike the first one, the capacitor starts with a non-zero voltage across it, namely, \$1.16\mathrm{~V}\$. This means the initial voltage across the resistor becomes \begin{equation} \Bigl. V_R(t) \Bigr|_{t=2\mathrm{~ms}} = 5\mathrm{~V} - 1.16\mathrm{~V} = 3.84\mathrm{~V}. \end{equation}

The voltage across the capacitor during this half cycle is \begin{align} V_C(t) &= 5\mathrm{~V} + (1.16\mathrm{~V} - 5\mathrm{~V}) e^{-(t - 2\mathrm{~ms})/(RC)}\\ V_R(t) &= 5\mathrm{~V} - V_C(t) \\ &= (5\mathrm{~V} - 1.16\mathrm{~V}) e^{-(t - 2\mathrm{~ms})/(RC)}. \end{align} For \$t=3\mathrm{~ms}\$, this is \begin{align} \Bigl. V_C(t) \Bigr|_{t=3\mathrm{~ms}} &= 5\mathrm{~V} + (1.16\mathrm{~V} - 5\mathrm{~V}) e^{-1} \\ &= 3.59\mathrm{~V} \\ \Bigl. V_R(t) \Bigr|_{t=3\mathrm{~ms}} &= 5\mathrm{~V} - 3.59\mathrm{~V} \\ &= 1.41\mathrm{~V}. \end{align}

The process continues until a steady state is reached. Here the term ``steady state'' means that the voltages across the capacitor at the start of each cycle have the same absolute value, and similarly for the resistor.

The voltages across the resistor at the beginning and end of the three half cycles analyzed in detail here match those shown in the output of your LTspice simulation: \begin{align} 5\mathrm{~V} &\to 1.84\mathrm{~V} \\ -3.16\mathrm{~V} & \to -1.16\mathrm{~V} \\ 3.84\mathrm{~V} &\to 1.41\mathrm{~V}. \end{align}

Steady State Solution

When the system reaches a steady state, what are the maximum and minimum capacitor voltages?

Here, again, is the general solution given above to the differential equations describing this system: \begin{align*} v(t) &= V_f + (V_i - V_f) e^{-t/\tau} \end{align*}
When the voltage supply's output is high, and if it nevery changed, the capacitor's voltage eventually would settle at \$V_f = V_\text{s}\$. When it is low (zero), it would settle at \$V_f = 0\mathrm{~V}\$.

Assume initially that the power supply outputs a zero voltage. Then \begin{align*} v(\tau) &= V_{f_1} + (V_{i_1} - V_{f_1}) e^{-1}\\ &= V_{i_1} e^{-1} \end{align*} where \$V_{f_1}\$ is the capacitor voltage as time goes to infinity and \$V_{i_1}\$ is the voltage at the beginning of the time interval. This is the initial voltage for the second interval, so \begin{align*} v(\tau) &= V_{f_1} + (V_{i_1} - V_{f_1}) e^{-1}\\ &= V_{i_1} e^{-1} \end{align*} At this point the power supply switches to output voltage \$V_\text{s}\$. If we let \$V_{f_2}\$ be the capacitor voltage that would arise in this interval if the voltage supply's output did not change and if time went to infinity, then \$V_{f_2} = V_\text{s}\$. Also let \$V_{i_2}\$ be the voltage at the beginning of the second interval. It is the same as the voltage \$V_{f_1}\$ at the end of the first interval. Then \begin{align*} v(2\tau) &= V_{f_2} + (V_{i_2} - V_{f_2}) e^{-1} \\ &= V_\text{s} + \left( V_{i_1}.e^{-1} - V_\text{s} \right) e^{-1}, \end{align*} The exponential \$e^{-1}\$ because it is assumed that each phase of the waveform takes a single time constant \$\tau\$. (Since both parts of the full cycle take the same amount of time, the duty cycle \$\delta=50\%\$.)

At steady state we expect the capacitor voltage to have returned to its initial state, that is, \$v(2\tau) = V_{i_1}\$, so \begin{align*} V_{i_1} &= V_\text{s} + \left( V_{i_1} e^{-1} - V_\text{s} \right) e^{-1} \end{align*}

Gathering like terms gives \begin{align*} V_{i_1} \left( 1 - e^{-2} \right) &= V_\text{s} \left( 1-e^{-1} \right). \end{align*} Solving for \$V_{i_1}\$ gives \begin{align*} V_{i_1} &= V_\text{s} \left( \frac{1-e^{-1}}{1 - e^{-2}} \right) \\ &= 0.731 V_\text{s}. \end{align*} If \$V_\text{s}=5\mathrm{~V}\$, then \$V_{i_1}=3.655\mathrm{~V}\$. We now can compute \begin{align*} V_{f_1} &= V_{i_1} e^{-1} \\ &= 1.345\mathrm{~V} \\ &= V_{i_2}. \end{align*} We can check that \$v(2\tau) = v(\tau)\$: \begin{align*} v(2\tau) &= V_\text{s} + \left( V_{i_2} - V_\text{s} \right) e^{-1} \\ &= V_\text{s} + \left( V_{f_1} -V_\text{s} \right)e^{-1} \\ &= 5\mathrm{~V} + \left( 1.345\mathrm{~V} - 5\mathrm{~V} \right) e^{-1} \\ &= 3.655\mathrm{~V}. \end{align*} This is the same as \$V_{i_1}\$, showing that the capacitor voltages do, indeed, oscillate between \$1.345\mathrm{~V}\$ and \$3.655\mathrm{~V}\$.


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.