Re: Find a dood function for fitting data
- To: mathgroup at smc.vnet.net
- Subject: [mg42134] Re: [mg42096] Find a dood function for fitting data
- From: "Mihajlo Vanevic" <mvane at eunet.yu>
- Date: Fri, 20 Jun 2003 04:57:32 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Is this good enaugh?? In[]:= << Statistics`NonlinearFit` In[]:= data = {{0.5, 0.089}, {0.7, 0.12}, {1, 0.1652}, {2, 0.254}, {3, 0.3}, {4, 0.325}, {5, 0.34}, {7, 0.35}, {10, 0.35}, {15, 0.33}, {20, 0.32}}; In[]:= f[x_] = NonlinearFit[data, a1*(Exp[-b1*x] - Exp[-b2*x]), {x}, {{a1, 1.}, {b1, 2.}, {b2, 1.}}, RegressionReport -> BestFitParameters] In[]:= Plot[f[x1], {x1, 0.5, 20}, Epilog -> {Hue[0.], PointSize[0.02], Map[Point, data]}, PlotRange -> All] In[]:= data1 = {{0.5, 0.11}, {0.7, 0.15}, {1, 0.2112}, {2, 0.322}, {3, 0.37}, {4, 0.391}, {5, 0.399}, {7, 0.4}, {10, 0.38}, {15, 0.36}, {20, 0.33}}; In[]:= f1[x_] = NonlinearFit[data1, a1*(Exp[-b1*x] - Exp[-b2*x]), {x}, {{a1, 1.}, {b1, 2.}, {b2, 1.}}, RegressionReport -> BestFitParameters] In[]:= Plot[f1[x1], {x1, 0.5, 20}, Epilog -> {Hue[0.], PointSize[0.02], Map[Point, data1]}, PlotRange -> All] Regards, Mihajlo Vanevic ************************************************************** * At 2003-06-19, 03:59:00 * guillerm, guillerm at usal.es wrote: ************************************************************** >(*Dear friend, I want fit these data *) > >data = {{0.5, 0.089}, {0.7, 0.12}, {1, 0.1652}, {2, 0.254}, {3, 0.3}, { > 4, 0.325}, {5, 0.34}, {7, 0.35}, {10, 0.35}, {15, 0.33}, {20, 0.32}}; > >(*I have tested with a few function such as that the follow, but I > have not found a good fit*) > >Needs["Statistics`NonlinearFit`"]; > >fit[x1_] = NonlinearFit[data, a1 x1^b1 Exp[b2 x1], {x1}, {a1, b1, b2}] > >Plot[fit[x1], {x1, 0.5, 20}, Epilog -> Map[Point, data]] > >(*I have the same problem with this other data*) > >data1= {{0.5, 0.11}, {0.7, 0.15}, {1, 0.2112}, {2, 0.322}, {3, 0.37}, {4, >0.391}, {5, 0.399}, {7, 0.4}, {10, 0.38}, {15, 0.36}, {20, 0.33}}; > >(*I will appreciate if you find a good fit, with no many parameters, for both >data. Thanks >Guillermo >Sanchez*) > >--------------------------------------------- >This message was sent using Endymion MailMan. >http://www.endymion.com/products/mailman/ **************************************************************