0
|
6246 Views
|
4 Replies
|
3 Total Likes
View groups...
Share
GROUPS:

# FindFit problem

Posted 9 years ago
 Good day. I have been using Findfit over a set of data to find two unknown of an equation. What I used for input was: y=249-(1-a)/2.86* (b* 34.21)/a/(b-0.03)(Exp(b x-0.03* x)-1) data={{0, 249}, {0, 243}, {0.13, 241}, {0.25, 237}, {0.25, 237}, {0.38, 229}, {0.5, 217}, {0.5, 217}, {0.63, 208}, {0.75, 198}, {0.75, 200}} FindFit[data, 249-(1-a)/2.86* (b* 34.21)/a/(b-0.03)(Exp(b x-0.03* x)-1), {a,b}, x] However the results i got is "FindFit::nrjnum: The Jacobian is not a matrix of real numbers at {a, b} = {1., 1.}.". Does it means: the trend can't not fit into that equation? Or did I make a mistake somewhere in my syntax? Many thanks
4 Replies
Sort By:
Posted 9 years ago
 It would be easier if you posted in <> format. You had some typos x*b needs to have a space in between x b and functions like Exp[] need square brackets [...] In[6]:= data = {{0, 249}, {0, 243}, {0.13, 241}, {0.25, 237}, {0.25, 237}, {0.38, 229}, {0.5, 217}, {0.5, 217}, {0.63, 208}, {0.75, 198}, {0.75, 200}} Out[6]= {{0, 249}, {0, 243}, {0.13, 241}, {0.25, 237}, {0.25, 237}, {0.38, 229}, {0.5, 217}, {0.5, 217}, {0.63, 208}, {0.75, 198}, {0.75, 200}} In[7]:= fit = FindFit[data, 249 - (1 - a)/ 2.86 (b 34.21)/a/(b - 0.03) (Exp[b x - 0.03*x] - 1), {a, b}, x] Out[7]= {a -> 0.170384, b -> 0.84151} In[8]:= y = 243 - (1 - a)/2.86 (b 34.21)/a/(b - 0.03) (Exp[b x - 0.03*x] - 1) /. fit Out[8]= 243 - 60.3948 (-1 + E^(0.81151 x)) 
Posted 9 years ago
 del
Posted 9 years ago
 No problem. Also, define equation once makes it easier: In[8]:= data = {{0, 249}, {0, 243}, {0.13, 241}, {0.25, 237}, {0.25, 237}, {0.38, 229}, {0.5, 217}, {0.5, 217}, {0.63, 208}, {0.75, 198}, {0.75, 200}} Out[8]= {{0, 249}, {0, 243}, {0.13, 241}, {0.25, 237}, {0.25, 237}, {0.38, 229}, {0.5, 217}, {0.5, 217}, {0.63, 208}, {0.75, 198}, {0.75, 200}} y = 249 - (1 - a)/2.86 (b 34.21)/a/(b - 0.03) (Exp[b x - 0.03 x] - 1) Out[9]= 243 - (11.9615 (1 - a) b (-1 + E^(-0.03 x + b x)))/( a (-0.03 + b)) In[10]:= FindFit[data, y, {a, b}, x] Out[10]= {a -> 0.430225, b -> 1.81015} In[11]:= Simplify[y /. %] Out[11]= 259.108 - 16.1084 E^(1.78015 x) 
Posted 9 years ago
 Ah, many thanks. I thought i just hit the wall in this. Much appreciate!!!