From: jj on 19 Dec 2009 06:26 Can anybody help me? I want to try to show my model (function) and my data in the same graph so I can see that my conclusions are correct. data= { {40,0.0624}, {50,42.2.276}, {58,127.718}, {60,216.608}, {70,2040.088}, I used FindFit for Exponential as my model to plot: t200= {Exp200} t200= {Exp300} model=aExp[kt]; fit=FindFit[data,model,{a,k},t] Best regads jj
From: Nasser M. Abbasi on 20 Dec 2009 06:52 "jj" <yohan2(a)spray.se> wrote in message news:hgid9p$o1i$1(a)smc.vnet.net... > Can anybody help me? > I want to try to show my model (function) and my data in the same > graph so I can see that my conclusions are correct. > data= { {40,0.0624}, {50,42.2.276}, {58,127.718}, {60,216.608}, > {70,2040.088}, > I used FindFit for Exponential as my model to plot: > t200= {Exp200} > > t200= {Exp300} > > model=aExp[kt]; > > fit=FindFit[data,model,{a,k},t] > > Best regads jj > Probably Exponential is not the best model? You can see the fit by doing: In[16]:= data = {{40, 0.0624}, {50, 42.2*0.276}, {58, 127.718}, {60, 216.608}, {70, 2040.088}}; Fit[data, Exp[t], t] Out[17]= 8.110309498068819*^-28*E^t So, a=8.110309498068819*^-28, and k=1 Why not try other models like a polynomial? --Nasser
From: Bob Hanlon on 20 Dec 2009 06:53 data = {{40, 0.0624}, {50, 42.276}, {58, 127.718}, {60, 216.608}, {70, 2040.088}}; In the model, express the multiplier as an additive term in the exponent model1 = Exp[a + k*t]; model2 = Exp[a + k*t] + b; fit = FindFit[data, #, {a, b, k}, t] & /@ {model1, model2} {{a->-8.16007,b->1.,k->0.22544},{a->-8.44721,b->7.41933,k->0.22949}} LogPlot[{ Tooltip[model1 /. fit[[1]]], Tooltip[model2 /. fit[[2]]]}, {t, 40, 70}, Epilog -> {Red, AbsolutePointSize[4], Point[{#[[1]], Log[#[[2]]]} & /@ data]}] Bob Hanlon ---- jj <yohan2(a)spray.se> wrote: ============= Can anybody help me? I want to try to show my model (function) and my data in the same graph so I can see that my conclusions are correct. data= { {40,0.0624}, {50,42.2.276}, {58,127.718}, {60,216.608}, {70,2040.088}, I used FindFit for Exponential as my model to plot: t200= {Exp200} t200= {Exp300} model=aExp[kt]; fit=FindFit[data,model,{a,k},t] Best regads jj
From: Bill Rowe on 20 Dec 2009 06:53 On 12/19/09 at 6:26 AM, yohan2(a)spray.se (jj) wrote: >Can anybody help me? I want to try to show my model (function) and >my data in the same graph so I can see that my conclusions are >correct. data= { {40,0.0624}, {50,42.2.276}, {58,127.718}, >{60,216.608}, {70,2040.088}, I used FindFit for Exponential as my >model to plot: t200= {Exp200} >t200= {Exp300} >model=aExp[kt]; >fit=FindFit[data,model,{a,k},t] Here is how I would do what you are asking: In[1]:= data = {{40, 0.0624}, {50, 42.2 .276}, {58, 127.718}, {60, 216.608}, {70, 2040.088}}; In[2]:= model = a Exp[t k]; param = FindFit[data, model, {{a, 1}, {k, 0}}, t] Out[3]= {a->0.000251022,k->0.227297} In[4]:= LogPlot[model /. param, {t, 35, 75}, Epilog -> {PointSize[.02], Point[data /. {s_, b_} :> {s, Log[b]}]}, PlotRange -> {.001, 5000}] It looks like either a simple exponential is not a good model for your data or there is a problem with the data point {40, 0.0624}. If this point were deleted, there would be no apparent problem with the fit.
From: Thomas Dowling on 20 Dec 2009 06:55 Hello, I think there a few ways of approaching this problem. 1. The following are the data data = {{40, 0.0624}, {50, 42.2 .276}, {58, 127.718}, {60, 216.608}, {70, 2040.088}}; 2. Use ListPlot to 'take a look': dataplot = ListPlot[data, PlotMarkers -> {Style["\[FilledSquare]", Red], 10}, AxesOrigin -> {0, 0}] 3. The data may be fitted to the exponential function as follows (note that initial values have been chosen) Clear[a, k]; model = ao E^(k t); soln = FindFit[data, model, { {ao, 4}, {k, 0.05}}, t] 4. A fitted equation may now be generated fittedeqn = ao E^ (k t) /. soln 5. 'Take a look' at the fitted plot plotfitted = Plot[fittedeqn, {t, 0, Max[data[[All, 1]]] + 15}, PlotStyle -> {Green}, AxesOrigin -> {0, 0}] 5. 'Show both plots superimposed: Show[dataplot, plotfitted] 6.( Do you need to show a data point for time zero?) Tom Dowling On Sat, Dec 19, 2009 at 11:26 AM, jj <yohan2(a)spray.se> wrote: > Can anybody help me? > I want to try to show my model (function) and my data in the same > graph so I can see that my conclusions are correct. > data= { {40,0.0624}, {50,42.2.276}, {58,127.718}, {60,216.608}, > {70,2040.088}, > I used FindFit for Exponential as my model to plot: > t200= {Exp200} > > t200= {Exp300} > > model=aExp[kt]; > > fit=FindFit[data,model,{a,k},t] > > Best regads jj > >
|
Pages: 1 Prev: vector and matrix valued functions Next: Is it possible to dynamically construct arguments to |