RE: Find a dood function for fitting data
- To: mathgroup at smc.vnet.net
- Subject: [mg42131] RE: [mg42096] Find a dood function for fitting data
- From: "David Park" <djmp at earthlink.net>
- Date: Fri, 20 Jun 2003 04:57:30 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Guillermo, What do you mean by a good fit? If the data are supposed to follow a definite law, and they don't, then there is simply a lot of error in the data. If you are trying to find a law that the data should fit, then it is up to you to fish around for a form that gives a good fit, perhaps using information about the process you are dealing with. Did Max Planck write to something like MathGroup complaining about the poor fit to the black body spectrum data? I you just want a continuous curve that goes through all the points, why not use interpolation? 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}}; f[t_] = Interpolation[data, InterpolationOrder -> 1][t] InterpolatingFunction[{{0.5, 20.}}, "<>"][t] Plot[f[x1], {x1, 0.5, 20}, Epilog -> {AbsolutePointSize[4], Point /@ data}, PlotRange -> All]; David Park djmp at earthlink.net http://home.earthlink.net/~djmp/ From: guillerm at usal.es [mailto:guillerm at usal.es] To: mathgroup at smc.vnet.net (*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/