I'm trying to curve fit 3 data points. The system has the characteristics of the general function:
Y(x) = C*(1-e^(-b*x))
I have 3 ordered pairs (0,0),(y1,x1),(y2,x2).
I can solve for the undetermined constants (C & b) numerically from;
y_1 = C*(1-e^(-b*x_1))
y_2 = C*(1-e^(-b*x_2))
The solution (0,0) is naturally a consequence of the equations form.
However, after I do that the curve fits (0,0) and (x_1,y_1), but falls short on matching (x_2,y_2). What is the explanation for this?
Originally posted by joe shmoThat is a hard equation to solve!
I'm trying to curve fit 3 data points. The system has the characteristics of the general function:
Y(x) = C*(1-e^(-b*x))
I have 3 ordered pairs (0,0),(y1,x1),(y2,x2).
I can solve for the undetermined constants (C & b) numerically from;
y_1 = C*(1-e^(-b*x_1))
y_2 = C*(1-e^(-b*x_2))
The solution (0,0) is naturally a consequence of the eq ...[text shortened]... s (0,0) and (x_1,y_1), but falls short on matching (x_2,y_2). What is the explanation for this?
how did you do it?!
Originally posted by iamatigerThere were actual numbers (I didn't solve it generally) I used a spreadsheet.
That is a hard equation to solve!
how did you do it?!
From:
y_1 = C*(1-e^(-b*x_1))
C = y_1/(1-e^(-b*x_1)) eq(2)
y_2 = C*(1-e^(-b*x_2)) eq(3)
Sub eq(2)--> eq(3)
y_2 = y_1/(1-e^(-b*x_1))*(1-e^(-b*x_2))
Solve for b from
y_1/(1-e^(-b*x_1))*(1-e^(-b*x_2)) - y_2 = 0
procedure:
initial guess on b
look for positive to negative change
increase precision around change
Lather
Rinse
Repeat
Solve for "C" from eq(2)
Originally posted by iamatigerSure,
Any chance of your initial numbers? It is an interesting conundrum, but I think the solution does depend quite strongly on the numbers because of the powers (and can the values be complex numbers, by the way?)
(y,x)
(0,0)
(3430,6.417)
(4250,16.917)
The solution for "b" I found was between 0.26 - 0.27, C = 4201.78
If you mean the values of the constants being imaginary, I would say probably not.
Originally posted by joe shmoAs x approaches infinity, y will approach C because it will be y=C*(1-0). That should be a maximum. Therefore your C cannot equal 4201.78 while your y equals 4250 in the third point. You need a C that is greater than 4250.
Sure,
(y,x)
(0,0)
(3430,6.417)
(4250,16.917)
The solution for "b" I found was between 0.26 - 0.27, C = 4201.78
If you mean the values of the constants being imaginary, I would say probably not.
I found that eliminating B worked
B = -ln(1-y1/C)/x1
which then gives
x2/x1 = ln(1-y2/C)/ln(1-y1/C)
ln(1-y2/C)/ln(1-y1/C) - x2/x1 crosses zero when C is between 4316.498599 and 4316.4986
so I estimated C to be 4316.4985995 and calculated B to be 0.24667606
These values fit your input data very well indeed
However eliminating C also worked:
C = y1/(1-exp(1-Bx1)
y2/y1 = (1-exp(-Bx2))/(1-exp(-Bx1))
{where exp(x) means e^x}
these gave exactly the same values for B and C, and look the same as your equations, so perhaps there was a typo somewhere when you did you lathering,, rinsing and repeating? Perhaps did your function exp() mean 10^x or something like that?
Originally posted by iamatigerNo... I re-checked my equation, and found I flipped some signs being sloppy with the algebra...oddly enough the solution to the wrong equation was somewhat close to the proper equations solution!
looking at what you said again, I don't suppose you wrote b down wrongly Joe?
b is between 0.2[b]46 and 0.247 ....[/b]
Anyhow, thanks for you help in spotting the error!