- 08 Jul '14 20:35I'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? - 08 Jul '14 21:31

That is a hard equation to solve!*Originally posted by joe shmo***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?! - 08 Jul '14 22:15

There were actual numbers (I didn't solve it generally) I used a spreadsheet.*Originally posted by iamatiger***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) - 09 Jul '14 11:10 / 1 edit

Sure,*Originally posted by iamatiger***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. - 10 Jul '14 07:09 / 1 edit

As 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.*Originally posted by joe shmo***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. - 10 Jul '14 20:54 / 3 editsI 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? - 11 Jul '14 21:03

No... 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!*Originally posted by iamatiger***looking at what you said again, I don't suppose you wrote b down wrongly Joe?**6 and 0.2

b is between 0.2[b]4**4**7 ....[/b]

Anyhow, thanks for you help in spotting the error!