Re: NonlinearFit for specific data
- To: mathgroup at smc.vnet.net
- Subject: [mg117844] Re: NonlinearFit for specific data
- From: DrMajorBob <btreat1 at austin.rr.com>
- Date: Fri, 1 Apr 2011 02:35:33 -0500 (EST)
Here's a reasonable procedure: data2 = {{0, 773.59}, {30, 2351.12}, {60, 4205.8}, {90, 4222.69}, {120, 4222.69}, {150, 704.328}, {180, 1388.28}, {210, 1388.28}, {240, 1821.23}, {270, 1821.23}, {300, 754.109}, {330, 773.59}, {360, 773.59}}; {min, max} = Through[{Min, Max}@data2[[All, 1]]]; data3 = data2 /. {a_, b_} :> {a, Log@b}; quadratic = a + b x + c x^2; fit1 = FindFit[data3, quadratic, {a, b, c}, x]; model = Exp@quadratic; initial = fit1 /. Rule -> List fit2 = FindFit[data2, model, initial, x] {{a, 7.45656}, {b, 0.00453122}, {c, -0.0000207059}} {a -> 6.97238, b -> 0.0332337, c -> -0.000192787} maximum = Max[First@Maximize[model /. fit2, x], Max@data2[[All, -1]]]; Show[Plot[{model /. fit1, model /. fit2}, {x, min, max}, PlotRange -> {0, maximum}], ListPlot@data2] The plot suggests (IMHO) that such a model is a poor fit to this data, no matter WHAT parameters are chosen. Bobby On Thu, 31 Mar 2011 04:01:55 -0500, Alexandre Souza <costamfix at gmail.com> wrote: > Dear Group, > I have the following data : > data2 = { {0, 773.59},{30, 2351.12},{60, 4205.8}, {90, 4222.69},{120, > 4222.69},{150, 704.328}, > {180, 1388.28},{210, 1388.28},{240, 1821.23},{270, 1821.23},{300, > 754.109},{330, 773.59},{360, 773.59}}; > I want the following curve fit : > NonlinearFit[data2, Exp[ a + b x + c x^2], x, {a, b, c}] > Unfortunatelly I get some "FindFit::sszero > FindMinimum::sszero" message, and the given result is ackward. > I also tried FindFit and NonlinearRegress without success. > Any comment would be very welcome. > Alex > -- DrMajorBob at yahoo.com