Re: Plotting a curve in space

*To*: mathgroup at christensen.cybernetics.net*Subject*: [mg1923] Re: Plotting a curve in space*From*: rjfrey at rentec.com (Robert J. Frey)*Date*: Sun, 20 Aug 1995 19:40:11 -0400*Organization*: Renaissance Technologies Corp.

Luke Dones (luke at boombox.arc.nasa.gov) wrote: : Hi -- I'd like to plot the orbit of a satellite which has : been calculated by numerical integration. The data is basically : an array of time (equally spaced) and Cartesian position : coordinates x, y, and z. So far I've just been plotting xy and : xz projections of the data with a canned package for 2-D graphics. : It seemed that Mathematica (which I'm not very familiar with) : should be able to plot the orbit in 3 dimensions. But none of : the routines mentioned in Wolfram's book seem to do exactly what : I want. The output I want would look something like the curve in : 3-dimensions produced by ParametricPlot3D, except that I don't have : an explicit form for x, y, and z as a function of time. Let's say the data are arranged in a 3 by T matrix, m, where m[[t, {1,2,3}]] is the values of {x,y,z} at time t. Then the row index of m provides a natural parameterization of the line in three space. Note, WOLG, I'm assuming the time steps are of length 1. Write a function f[t_, m_] which returns a three vector whose value is the linear interpolation of m[[Ceiling[t], {1,2,3}]] and m[[Floor[t], {1,2,3}]]. If you want to get really snazzy, you can use something less declasse than linear interpolation. Mma has an Interpolation function and supports InterpolatingFunction objects which will do this for you. There you would have the additional benefit of not needing the time steps to be equally spaced. -- Regards, Robert (rjfrey at rentec.com)