# Thread:

1. ## 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)?

2. 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

3. 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?

4. 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:
$I = I_0 e^{-t/(RC)}$

$ln(I) = ln \left ( I_0 e^{-t/(RC)} \right )$

$ln(I) = ln(I_0) - \frac{1}{RC} \cdot t$

$ln(I) = -\frac{1}{RC} \cdot 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

5. 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.

6. 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.

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...

$\frac{1}{RC} = \frac{1}{R \frac{Q}{V}} = \frac{V}{QR}$

Now recall that V = I0*R when the capacitor starts to discharge:
$\frac{1}{RC} = \frac{V}{QR} = \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

7. 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

8. 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
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 6, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 20, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "github"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "english_confidence": 0.9398637413978577, "perplexity_flag": "middle"}