# Method of Least Squares

• Apr 25th 2011, 12:21 AM
Salcybercat
Method of Least Squares
Question:

A capacitor C is initially charged to 10V and then connected across a resistor R. The current through R is measured at 1 milisecond intervals is:

t : 0 1 2 3 4 ms +-0.5%
i : 4.5 2.8 1.5 1.0 0.6 mA +-2.5%

(Basically this is a table where i corresponds to the t value)
Using the method of least squares, find R and C.

I need help on what equation I should use. Is it i=ie-(t/RC)?
• Apr 25th 2011, 05:37 AM
topsquark
Quote:

Originally Posted by Salcybercat
Question:

A capacitor C is initially charged to 10V and then connected across a resistor R. The current through R is measured at 1 milisecond intervals is:

t : 0 1 2 3 4 ms +-0.5%
i : 4.5 2.8 1.5 1.0 0.6 mA +-2.5%

(Basically this is a table where i corresponds to the t value)
Using the method of least squares, find R and C.

I need help on what equation I should use. Is it i=ie-(t/RC)?

If you meant I = I0 * e^{-t/(RC)}, then yes. So take the ln of both sides to do your linear regression.

-Dan
• Apr 25th 2011, 08:12 AM
Salcybercat
Just to make sure, I0 would be the initial current when t=0, which would make the equation I = 4.5 * e^{-t/(RC)}. Am I right?
• Apr 25th 2011, 10:03 AM
topsquark
Quote:

Originally Posted by Salcybercat
Just to make sure, I0 would be the initial current when t=0, which would make the equation I = 4.5 * e^{-t/(RC)}. Am I right?

I0 is one of the pieces of information you want to calculate. Take the ln of both sides of the equation:
http://latex.codecogs.com/png.latex?I = I_0 e^{-t/(RC)}

http://latex.codecogs.com/png.latex?...(RC)} \right )

http://latex.codecogs.com/png.latex?...1}{RC} \cdot t

http://latex.codecogs.com/png.latex?...ot t + ln(I_0)

The advantage of this form is that the equation is now in the form y = mx + b where y = ln(I) and x = t. So to do the linear regression use the t values as your x data and ln(I) values as your y data. You will come out with a slope and an intercept. The slope will be equal to -1/(RC) and the intercept will be ln(I0).

-Dan
• Apr 26th 2011, 12:43 AM
Salcybercat
Thank you for the clarification! However, I still didn't manage to get the answer. (R=2.2kohm and C = 0.89microFarad)
I've attached my workings below. I hope it's clear enough for you to understand. Do comment on any mistaken steps.

http://i53.tinypic.com/wqygw4.jpg
• Apr 26th 2011, 06:12 AM
topsquark
Quote:

Originally Posted by Salcybercat
Thank you for the clarification! However, I still didn't manage to get the answer. (R=2.2kohm and C = 0.89microFarad)
I've attached my workings below. I hope it's clear enough for you to understand. Do comment on any mistaken steps.

http://i53.tinypic.com/wqygw4.jpg

I cheated and did the regression on my calculator. My answers are close, but different from yours. If you are allowed to use a computer to do the problem I'd recommend it.

I get m = 0.505943 x 10^3 /s and c = 1.497552. Thus I'm getting 1/(RC) = 0.505943 x 10^3 /s and I0 = 4.47073 x 10^{-3} A.

Now we have to get a bit wily. We only have one number to get RC so we need another relationship. We get that through the definition of capacitance:
C = Q/V, where Q is the initial charge on the capacitor (unknown at this point) and V is the charging potential 10 V. So...

http://latex.codecogs.com/png.latex?...= \frac{V}{QR}

Now recall that V = I0*R when the capacitor starts to discharge:
http://latex.codecogs.com/png.latex?... \frac{I_0}{Q}

and we have values of 1/(RC) and I0 from the regression. So you can find Q. From Q you can find C. From C you can find R.

Using my values I get your given answers. Your values give answers slightly off from that. I am at a loss as to what advice to give you to allow you to calculate better numbers.

-Dan
• Apr 27th 2011, 02:50 AM
Salcybercat
I must've done something wrong rounding up the numbers when calculating it manually (and no, we wouldn't be allowed to use computers during our exams :()
Yes I was confused about what other equations I needed to use to compare with the RC-equation. ( I thought of using the equation of i = C (dv/dt) but I wasn't sure if the method of least squares would work with a differential equation.
But thank you for the step-to-step explanation! I got the answers :)
• Apr 27th 2011, 05:05 AM
topsquark
Quote:

Originally Posted by Salcybercat
I must've done something wrong rounding up the numbers when calculating it manually (and no, we wouldn't be allowed to use computers during our exams :()

Bummer. I particularly hate doing these "by hand." Glad you got the answers and good luck on the exams!

-Dan