Re: Using Nearest on a group of points
- To: mathgroup at smc.vnet.net
- Subject: [mg117723] Re: Using Nearest on a group of points
- From: Peter Pein <petsie at dordos.net>
- Date: Wed, 30 Mar 2011 04:14:02 -0500 (EST)
- References: <im9sk8$g5j$1@smc.vnet.net> <imc952$1ke$1@smc.vnet.net> <imfae8$iue$1@smc.vnet.net> <imshcc$5oo$1@smc.vnet.net>
Am 29.03.2011 13:55, schrieb Martin VavpotiÄ?: > I did my own version of it and it looks like this: > > Manipulate[Block[{spl = ListLinePlot[Final, PlotRange -> {{0, 2}, {1, > 6.5}}]}, > Show[spl, Graphics[{Red, PointSize[.02], Point[{Final[[j, 1]], > Final[[j, 2]]}]}]]], {j, 1, 187}] (I believe the brackets are fine.) > > Final is a 187=D72 Table with x,y values of the graph. The animation > itself works like it should, but a few of the frames turn a red > background and I get these warnings: > > Part::pspec: Part specification 89.4` is neither an integer nor a list > of integers.>> > > Am I doing something wrong? > > Martin > > On 24 mar., 12:37, Peter Pein<pet... at dordos.net> wrote: >> >> the dot can be done with: >> >> Manipulate[Block[{spl=Plot[Sin[x],{x,0,2Pi}]}, >> Show[spl,Graphics[{Red,PointSize[.02],Point[{x0,Sin[x0]}]}]]], >> {x0,0,2Pi}] >> >> and I didn't try out, but I guess the Animation should depend on x0 too >> and reside inside the Show[]. >> >> Peter > > Oh dear, it's not too obvious: you use j as (integer) index. Take care that j takes only integer values: Manipulate[......,{j,1,187,1}] should do. Cheers, Peter