# Re: [R] 3D trajectory plot?

From: Clint Bowman <clint_at_ecy.wa.gov>
Date: Fri, 14 Nov 2008 07:42:42 -0800 (PST)

In reading this thread the thought popped into my head. A smooth representation of the trajectory defined by the data in Chris's message from Wednesday is very similar to the guidance problem of a rocket. I believe that guidance engineers use Kalman filters to smooth out noisy data to generate the control signals to keep the missile on course. Would an such an approach work here to produce a smooth estimate to the trajectory described by the data?

Clint

```Clint Bowman			INTERNET:	clint_at_ecy.wa.gov
Air Dispersion Modeler		INTERNET:	clint_at_math.utah.edu
Air Quality Program		VOICE:		(360) 407-6815
Department of Ecology		FAX:		(360) 407-7534

USPS:  		PO Box 47600, Olympia, WA 98504-7600
Parcels:	300 Desmond Drive, Lacey, WA 98503-1274

```

> On 14/11/2008 3:10 AM, Yihui Xie wrote:
> > But it's not _smooth_ (as Chris asked for)... I also thought about the
> > plot3d(), but I don't know how to smooth the 3D points. AFAIK spline
> > functions only work for 2D cases in R? (Sorry I'm not familiar with
> > splines)
>
> There are lots of definitions of smooth. One easy one is to use splines in
> each coordinate, with the independent variable being an implied time
> coordinate 1, 2, 3, etc. That is (with only the first 4 points, I'm lazy):
>
> x <- splinefun(1:4, c(25,12,2,2))
> y <- splinefun(1:4, c(32,25,12,2))
> z <- splinefun(1:4, c(40,32,25,12))
>
> times <- seq(1, 4, len=200)
> plot3d(x(times), y(times), z(times), type="l")
>
> Duncan Murdoch
>
> >
> > Regards,
> > Yihui
> > --
> > Yihui Xie <xieyihui_at_gmail.com>
> > Phone: +86-(0)10-82509086 Fax: +86-(0)10-82509086
> > Mobile: +86-15810805877
> > Homepage: http://www.yihui.name
> > School of Statistics, Room 1037, Mingde Main Building,
> > Renmin University of China, Beijing, 100872, China
> >
> >
> >
> > On Wed, Nov 12, 2008 at 7:22 PM, Duncan Murdoch <murdoch_at_stats.uwo.ca>
> > wrote:
> > > Chris Jarman wrote:
> > > > Hello,
> > > > I'm attempting to create a smooth, 3D plot of a trajectory (rather
> > > > than the cloud or wireframe functions). I would rather the individual
> > > > data points not be visible. I've had no luck finding this on the
> > > > graphics or help pages. Thank you in advance. Chris
> > > > Some example data, just in case:
> > > >
> > > > 25 32 40
> > > > 12 25 32
> > > > 2 12 25
> > > > 2 2 12
> > > > 20 2 2
> > > > 1 20 2
> > > > 6 1 20
> > > > 5 6 1
> > > > 5 5 6
> > > >
> > > >
> > > plot3d(x,y,z, type='l') from rgl.
> > >
> > > Duncan Murdoch
> > >
> >
> > ______________________________________________
> > R-help_at_r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > and provide commented, minimal, self-contained, reproducible code.
>
> ______________________________________________
> R-help_at_r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help