0
$\begingroup$

First I entered the data and graph it, then I used the non-linear adjustment command to have a model of my data, I asked Mathematica for the square r, to know how good the model was, then I put together the graphs of the data and the adjustment , but I'm not satisfied with the result. I think it can be improved. Thank you.

DATA = {{16, 2508}, {18, 2518}, {20, 3000}, {22, 3423}, {24, 
3507}, {26, 3400}, {28, 3500}, {30, 3883}, {32, 3823}, {34, 
3646}, {36, 3708}, {38, 3333}, {40, 3517}, {42, 3214}, {44, 
3103}, {46, 2276}};
gt = ListPlot[DATA]
agt = NonlinearModelFit[DATA, b x^a, {a, b}, x]
Show[ListPlot[DATA, PlotStyle -> Red], Plot[agt[x], {x, 0, 45}]]

This is my code

enter image description here

$\endgroup$
  • 1
    $\begingroup$ If you do not provide code that can easily be copied by other people, you are much less likely to get any help on your problem. $\endgroup$ – J. M. will be back soon Oct 10 '18 at 21:09
  • $\begingroup$ I added it, thanks. $\endgroup$ – Rayo LV Oct 10 '18 at 21:20
  • 1
    $\begingroup$ Is there a process that generates the data that would suggest a particular model (such as the one you tried)? $\endgroup$ – JimB Oct 10 '18 at 21:23
  • $\begingroup$ This is the description of the problem. An article by J.Agricultural En.Research, 1975 (pp.353-361) reports the following data (DATA), with the number of days after flowering (D), and harvest yield (R) : (D) and (R) are the data inside the "DATA" input $\endgroup$ – Rayo LV Oct 10 '18 at 21:31
  • 1
    $\begingroup$ How about a simple quadratic? $a x^2 + b x + c$ $\endgroup$ – wxffles Oct 10 '18 at 22:32
4
$\begingroup$
Clear[a, b, c, f, x]

data = {{16, 2508}, {18, 2518}, {20, 3000}, {22, 3423}, {24, 
    3507}, {26, 3400}, {28, 3500}, {30, 3883}, {32, 3823}, {34, 
    3646}, {36, 3708}, {38, 3333}, {40, 3517}, {42, 3214}, {44, 
    3103}, {46, 2276}};

As suggested by wxffles

model = a*x^2 + b*x + c;

f[x_] = (nlm = NonlinearModelFit[data, model, {a, b, c}, x]) // Normal

(* -1945.07 + 362.23 x - 5.74724 x^2 *)

Plot[f[x], {x, 14, 49},
 PlotRange -> {2000, 4000},
 Epilog -> {Red, AbsolutePointSize[4], Point[data]}]

enter image description here

nlm["ParameterTable"]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.