Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #14080

Re: Problem with function definition inside DynamicModule

From Themis Matsoukas <tmatsoukas@me.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Problem with function definition inside DynamicModule
Date 2013-04-06 09:10 +0000
Message-ID <kjooph$oiv$1@smc.vnet.net> (permalink)
Organization Time-Warner Telecom

Show all headers | View raw


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]

Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread


Thread

Re: Problem with function definition inside DynamicModule Themis Matsoukas <tmatsoukas@me.com> - 2013-04-06 09:10 +0000

csiph-web