# Circuit with resistor, switch and capacitor

The thing is this; they have started a project called CSE (Cumputers in Science Education) which basicly means we don't really end up solving differential equations without using a computer all the time, f. ex forward Euler method. We start programming the first year, so a lot(to much) of our focus goes into programming...

They call it pioneering, I call it a mistake.

l2(t) = VsR1/(R1 + R2)(1 - e-t/τ) + Vs/R2e-t/τ

When I find Vc(t), I just use that

Ic = C(dVc/dt) ?

I just find the derivative of Vc and multiply by C ?

gneill
Mentor
Thank you for that information.

I took part in a similar initiative when I was in university (back when dinosaurs ruled the earth!). The program was for a Bachelor of Computer Science, Electronic Systems. It combined computer science core courses, electrical engineering core courses, and control systems core courses. Nearly no electives at all, so lots of brain-sweat and no time to party. As it turned out, I was the only student to graduate on-time in that first class (*blush*).

To give the school credit, they did go into all the gory details and didn't leave anything out along the way. Lot's of work, but all the groundwork was laid in a smooth progression. So they obviously planned the initiative very well, even if was perhaps a tad "aggressive" given the on-time graduating rate for the first pass at it.

gneill
Mentor
l2(t) = VsR1/(R1 + R2)(1 - e-t/τ) + Vs/R2e-t/τ
Something's gone amiss. The units in the first term do not work out to current (amps). And I'd expect a constant offset for the second term, not a decaying exponential. But it's really close to what I'd expect.

Can you show some details of how you arrived at your result?

Yes, I used the wrong value, I think I meant;

l2(t) = Vs/(R1 + R2)(1 - e-t/τ) + Vs/R2e-t/τ

But this is also not right given that;
And I'd expect a constant offset for the second term, not a decaying exponential.

I can always rewrite it though;

l2(t) = Vs/(R1 + R2) - Vs/(R1 + R2)(e-t/τ) + Vs/R2e-t/τ

l2(t) = Vs/(R1 + R2) + (Vs/R2 - Vs/(R1 + R2))e-t/τ

gneill
Mentor
Yes, that looks good.

And for Vs;

Vs(t) = VsR1/(R1 + R2)(1 - e-t/τ)

and therefore

Ic(t) = CVc'(t) = -C (VsR1/(R1 + R2))e-t/τ(-1/τ)

Ic(t) = (C/τ) (VsR1/(R1 + R2)e-t/τ)

Ic(t) = (1/Req) (VsR1/(R1 + R2)e-t/τ)

Ic(t) = (1/ R2 ) (Vse-t/τ)

Ic(t) = (Vs/ R2 )e-t/τ

gneill
Mentor
Yup. Looks good.

This is great!

But you mentioned in post #13
That is the "starting from the basics" approach, yes.

The thing is this, in the next task I'm asked to verify the result using a numerical method; ie. using a differential equation! (forward Euler for instance)

But I/we have solved it, by simply assuming the "form" of the function; I guess Im puzzled by the "starting from the basics" approach" you mentioned...

How does one go about finding the differential equation?

gneill
Mentor
How does one go about finding the differential equation?
One writes the circuit equations using the differential or integral forms for the capacitor voltage or current, then solve the resulting differential equation. So for example, for the simple case of a charged capacitor discharging through a resistor, writing KCL:

##C \frac{dV}{dt} +\frac{V}{R} = 0##

##\frac{dV}{dt} = -\frac{V}{R C}##

##\frac{dV}{V} = -\frac{dt}{R C} ##

and so on