Ask Your Question

Revision history [back]

Rather than trying to fit the data directly, how about fitting its logarithm:

var('a,b')
R = [[100, 0.0489], [110, 0.0633], [120, 0.1213],[130, 0.1244], [140, 0.1569], [150, 0.1693], [160, 0.3154], [170, 0.6146], [180, 0.9118], [190, 01.7478], [200, 2.4523], [210, 4.7945], [230, 17.9766], [240, 29.3237], [250, 52.4374], [260, 94.6463], [270, 173.3447], [280, 396.0443], [290, 538.6976], [300, 1118.9984], [310, 1442.3694], [320, 4151.9089], [330, 6940.7322]]

logR = []
for r in R:
    logR.append( [ r[0], log(r[1]) ] )

model(x) = a*x + b

fit = find_fit(logR, model)
print fit

p = scatter_plot(R)
p += plot( exp(a*x+b).subs(fit[0],fit[1]), (x,0,340) )
show(p)

The result of fitting the logarithm is

[a == 0.053300682674800925, b == -9.214845890267727]

which of course needs to be exponentiated to compare to the original data.

Here's a live example showing plots of the original data and the fit.