| 
October 27th, 2009, 03:45 AM
| | Newbie | | Join Date: Oct 2009
Posts: 2
Thanks: 1
Thanked 0 Times in 0 Posts
| | FindFit[]problem Hi,
I want to make a fitting curve just like '' y=A+B*Log[x^n] '' from the experimental data, but it always doesnt work...
Here it is:
data = {{0 , 100}, {0.0008, 126.992}, {0.00195, 147.187}, {0.0033, 164.79}, {0.005, 181.877}, {0.007, 198.982}, {0.01, 219.833}, {0.015, 246.441},{0.02, 278.042}, {0.027, 308.821}, {0.037, 341.473}, {0.047, 362.767}, {0.06, 379.048}, {0.08, 394.5}, {0.1, 405.422}, {0.12, 412.5}, {0.14, 415}, {0.17, 418}, {0.2, 420}, {0.24,
421}, {0.282, 422}}
model = a + b Log[x^n]
funk = FindFit[data, model, {a, b, n}, x]
and this is the warning: FindFit::nlnum: The function value {Indeterminate, -133.123, -152.427, -169.504, -186.175, -202.944, -223.438, -249.641, -280.954, -311.433, <<11>>} is not a list of numbers with dimensions {21} at {a, b, n} = {1, 1, 1}. I used the order to prove the data is numerical, but have no idea what the nonrectangle means...
Thanks a lot! [IMG]file:///c:/temp/moz-screenshot-2.jpg[/IMG] | 
October 27th, 2009, 04:25 AM
| | Super Member | | Join Date: Aug 2008
Posts: 601
Country: Thanks: 46
Thanked 262 Times in 227 Posts
| | The first point is {0,100} and that's causing the indeterminate part with Log(0). Try changing it to a very small value like 10^{-8} or so.
__________________ "I am beset by the ironies in my life" | | The following users thank shawsend for this useful post: | |  | 
October 27th, 2009, 04:57 AM
| | Newbie | | Join Date: Oct 2009
Posts: 2
Thanks: 1
Thanked 0 Times in 0 Posts
| | thanks to shawsend, that problem has been solved.
but I am a little dumb and here is another problem, if anybody is glad to get rid of it
model = a + b x^n
funk = FindFit[{{0, 100}, {0.0008, 126.992}, {0.00195, 147.187}, {0.0033, 164.79}, {0.005, 181.877}, {0.007, 198.982}, {0.01, 219.833}, {0.015, 246.441}, {0.02, 278.042}, {0.027, 308.821}, {0.037, 341.473}, {0.047, 362.767}, {0.06, 379.048}, {0.08, 394.5}, {0.1, 405.422}, {0.12, 412.5}, {0.14, 415}, {0.17, 418}, {0.2, 420}, {0.24, 421}, {0.282, 422}}, model, {a, b, n}, x]
the warning shows: FindFit::njnum: The Jacobian is not a matrix of numbers at {a, b, n} = {1., 1., 1.}. if the value of n is given, e.g. n=0.1, I can get results( like a -> -41.9803, b -> 506.786), but the result is not good enough, even I try all the kinds of value of n (from o.o1 to o.3). so maybe let the software choose the value of parameter itself is the best way. but now the problem is about Jacobian, is something to do correct it ?
Thanks again | | Thread Tools | | | | Display Modes | Linear Mode |
Posting Rules
| You may not post new threads You may not post replies You may not post attachments You may not edit your posts HTML code is Off | | | All times are GMT -7. The time now is 10:35 PM. | | |