Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.
|
|
Marc
Posts:
89
Registered:
7/2/10
|
|
Re: fit power curve with best exponent to data
Posted:
Feb 1, 2013 2:00 AM
|
|
"JK" wrote in message <kebtjc$kp3$1@newscl01ah.mathworks.com>... > "Tom Lane" <tlane@mathworks.com> wrote in message <kebk50$bq1$1@newscl01ah.mathworks.com>... > > >> I'm attempting to fit the following equation to a set of data > > >> characterizing something's autocorrelation function: > > >> > > >> y=e^(a*x)^n > > > > Your y seems to drop off exponentially, so you want the exponent to be > > negative, and you're raising it to a power that may not be an integer. If I > > change your function I can do the following to fit it: > > > > >> myexp = fittype('exp(a*(abs(x-b)^n))') > > myexp = > > General model: > > myexp(a,b,n,x) = exp(a*(abs(x-b)^n)) > > >> fit(x,y,myexp,'start',[-20,4.47,1]) > > ans = > > General model: > > ans(x) = exp(a*(abs(x-b)^n)) > > Coefficients (with 95% confidence bounds): > > a = -103.6 (-115.1, -92.15) > > b = 4.475 (4.474, 4.475) > > n = 1.065 (1.035, 1.094) > > > > While you may not want this function, I hope this illustrates what you can > > try with a function that you choose yourself. > > > > -- Tom > > Hi Tom, > > Yeah that's exactly what I was looking for, I'm just having trouble getting one type of model to work: an 'x-exponential' form where f(x) = exp[-(|z|/L)^x]. But thanks for the pointer towards 'fit'. > > Jack
Although I think your data is simply silly... CFTOOL worked fine for me for several fits....
Exponential:
General model Exp1: f(x) = a*exp(b*x) Coefficients (with 95% confidence bounds): a = 2.545e+157 (-Inf, Inf) b = -80.99 (-82.45, -79.54)
Goodness of fit: SSE: 0.003883 R-square: 0.9987 Adjusted R-square: 0.9987 RMSE: 0.008994
Gaussian:
General model Gauss1: f(x) = a1*exp(-((x-b1)/c1)^2) Coefficients (with 95% confidence bounds): a1 = 978 (-3410, 5366) b1 = 4.294 (4.183, 4.405) c1 = 0.06875 (0.04881, 0.08869)
Goodness of fit: SSE: 0.00313 R-square: 0.9989 Adjusted R-square: 0.9989 RMSE: 0.008161
Just as some examples.... Of course, garbage in, garbage out...
Keep walking, gentleman.
|
|
|
|