# RC circuit with sinusoidal voltage - initial behavior?

For a simple RC circuit with a sinusoidal voltage source, the differential equation is: $$\frac{dq}{dt}=\frac{sin(t)}{R}-\frac{q}{RC}$$ When I plot the solution to this differential equation using euler's method, I get this:

I'm confused as to what is happening in the first few cycles. Does this have something to do with transient response? Or are the initial conditions in combination with the sin(t) source forcing it to do that?

Obviously, as t increases, it settles into an equilibrium, but why does it not start out in equilibrium?

Thanks for the help.

• It would start in equilibrium, if you calculate the equilibrium conditions and set the initial conditions accordingly. – Hearth Nov 10 '18 at 0:09

but why does it not start out in equilibrium?

Because in general such systems don't start out in equilibrium. As pointed out, you could find a phase for the sine wave that would start the thing in equilibrium. I.e., let your excitation be $$\\sin\left(\phi + t\right)\$$, then find a value for $$\\phi\$$ that makes it work.

Does this have something to do with transient response? Or are the initial conditions in combination with the sin(t) source forcing it to do that?

These are actually the same question, asked two different ways. So -- yes.

Part of your problem is that what you're simulating isn't what you solved for. The $$\\sin(t)\$$ in your differential equation goes on forever, in both directions. You simulated it with a signal that is zero from $$\t=-\infty\$$ to $$\t=0\$$. In the Language of Signal Processing, what you "really" did was excite it with $$\x(t) = u(t)\sin(t)\$$, where $$\u(t)\$$ is the unit step function: $$u(t) = \begin{cases}0 & t < 0 \\ 1 & t >= 0\end{cases}$$

If your next question is "well, how do I learn how to solve for the transient response?" the answer is to learn how to use Laplace transforms to solve linear differential equations. If you know how to use Laplace, the answer just drops right out. If you don't know how to use Laplace -- learn!

I believe you answered your own question. The technical term to describe the response of the system after the transients "die out" would be "steady state".

You have implicitly set the initial condition: $$q(0) = 0$$ As Felthry pointed out in his comment, if you were to calculate the initial condition that produced the right "starting point" so that the sine wave "lined up" properly (in phase and amplitude) at $$t=0$$ then you wouldn't see the transient. For instance, if you are able to determine the steady state response: $$q_\text{steady state}(t) = A\cos(\omega t + \phi),$$ by measuring the amplitude and phase, then you just set the initial condition as follows: $$q(0) = q_\text{steady state}(0) = A\cos\phi$$ and you wouldn't see any transient.