Group Abstract Group Abstract

Message Boards Message Boards

Universal data (graph) fitting

Posted 12 years ago
Attachments:
POSTED BY: Sungwoo Yang
3 Replies
Posted 12 years ago

Hi Marco,

Thank you so much. This is exactly what I was looking for. You are awesome.

POSTED BY: Sungwoo Yang

Hi,

I forgot to say that this works of course also if you want to add legends.

M = 10; data = RandomReal[1, M];
Manipulate[
 Show[ListPlot[data, PlotStyle -> Red], 
  Plot[Evaluate[
    Normal[NonlinearModelFit[data, 
      Evaluate[Sum[Subscript[a, i] x^i, {i, 0, d}]], 
      Evaluate[Table[Subscript[a, i], {i, 0, d}]], x]]], {x, 0, 
    M + 1}, PlotRange -> All , 
   PlotLegends -> 
    Placed["Polynomial \nf(x)=" <> 
      ToString[
       TraditionalForm[
        Evaluate[
         Normal[NonlinearModelFit[data, 
           Evaluate[Sum[Subscript[a, i] x^i, {i, 0, d}]], 
           Evaluate[Table[Subscript[a, i], {i, 0, d}]], x]]]]], 
     Below]]], {d, 0, 10}]

Cheers,

M.

POSTED BY: Marco Thiel
POSTED BY: Marco Thiel
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard