MathGroup Archive 2013

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Problem with function definition inside DynamicModule

  • To: mathgroup at smc.vnet.net
  • Subject: [mg130377] Re: Problem with function definition inside DynamicModule
  • From: Themis Matsoukas <tmatsoukas at me.com>
  • Date: Sat, 6 Apr 2013 05:11:11 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • Delivered-to: l-mathgroup@wolfram.com
  • Delivered-to: mathgroup-newout@smc.vnet.net
  • Delivered-to: mathgroup-newsend@smc.vnet.net

I am not familiar with DynamicModule but here is a way to do the same thing using Manipulate:

showFit[myData_] := Manipulate[
   f = Fit[myData, Table[x^k, {k, 0, nn}], x];
   Show[
    ListPlot[myData,
     Joined -> False,
     PlotStyle -> {Red, AbsolutePointSize[7]},
     PlotRange -> All],
    Plot[f, {x, 0, 5}]
    ], {nn, {1, 2, 3, 4, 5}}
   ];

data = Table[{x, x^2 + RandomReal[{-1, 1}]}, {x, 0, 5}];
showFit[data]



  • Prev by Date: Re: Solve without vars
  • Next by Date: Re: Locators: Retrieve coordinates data to added locators
  • Previous by thread: Re: Problem with function definition inside DynamicModule
  • Next by thread: Solve without vars