# Sequence of data in 3D, joining the points

Let me just first say I am not actually trying to find a function for these set of data. All I am doing is joining the points to make a line.

Basically let's say I have some data, which I cleverly will call/name them as 'data' in Mathematica.

data:= {{1,0,0},{2,4,7},{2,6,7},{0,0,23}}

Now plotting them. (FYI, these data points are randomlly chosen)

ListPointPlot3D[data]

I should get a plot, but of course they are all disconnected. What I want to do is to join them. Unfortunately 'Joined -> True' does not exists in ListPointPlot3D, so I do not know how to join them

Any ideas?

EDIT

At the moment, I have a recursion. I will just show you the table

For instance

Table[x[n, t], {n, 1, 10}]

prints out a list of 10 data points in 3D. It will not work with Graphics3D

EDIT

I will write out exactly what I have

x[1, t_] := {0,0,0};

A[t_] := {{1, -t, 1}, {t, 2, 0}, {0, 0,t}}

B[t_] := Inverse[A[t]];

x[n_Integer, t_] /; n > 0 := B[t].x[n - 1, t];

Table[x[n, t], {n, 1, 10}]

I want to plot the points and join them in a curve. If possilbe I would even like to manipulate the plot. The range for $t \in [0,1]$

Everything updated

-
You could just use Graphics3D[Line[data]]... – J. M. Apr 7 '13 at 18:12
What do you mean by "it will not work"? – Jens Apr 7 '13 at 18:36
It gives me an error. I will write out the code. – Hawk Apr 9 '13 at 0:04
Your definition for A[t_] is circular, it can't work ... and you have two defs for the same thing (A[t_]) – Dr. belisarius Apr 9 '13 at 0:26
I made a typo, one sec – Hawk Apr 9 '13 at 0:54

Of course the Graphics3D approach in belisarius' answer is very general and should always work. But maybe you want to stick with ListPointPlot3D for some reason. Then you could use Show to combine the isolated points with a plot of the linear Interpolation between the points:

data = {{1, 0, 0}, {2, 4, 7}, {2, 6, 7}, {0, 0, 23}}

(* ==> {{1, 0, 0}, {2, 4, 7}, {2, 6, 7}, {0, 0, 23}} *)

iData =
Interpolation[Transpose[{Range[Length[#]], #} &@data],
InterpolationOrder -> 1];

Show[
ListPointPlot3D[data], ParametricPlot3D[iData[t], {t, 1, 4}]
]

It's worth mentioning here that Show always uses the options of the plot that comes first in the list, unless you specify additional options to Show (such as BoxRatios, if desired). You can also control the style of the points and curve separately using the usual options.

-
I always doubt when formatting a 3D list for feeding it into Interpolation. Sometimes I do like you did, and sometimes as in my answer here. Do you have any thoughts about what is the better way? – Dr. belisarius Apr 7 '13 at 20:25
I would have used your method, that's why I upvoted it... My answer was just motivated by the apparent "other problem" of the OP, which I don't understand yet. – Jens Apr 7 '13 at 20:48
As I understand it, he has {f1, f2, f3, ...} instead of {{x1,y1,f1} , {x2,y2,f2}, ...} – Dr. belisarius Apr 7 '13 at 20:50
@belisarius For what it's worth I would write: Interpolation @ MapIndexed[{#2, #} &, data] – Mr.Wizard Apr 8 '13 at 11:08
See edit 10 char – Hawk Apr 9 '13 at 0:06
t := RandomReal[]
x[n_, t_] := Sin@t
data = Table[{n, #, x[n, #]} &[t], {n, 1, 10}];

Graphics3D[{Line@data, PointSize[Large], Point@data},
PlotRange -> ({Min@# - 1, Max@# + 1} & /@ Transpose@data), Axes -> True]

Edit

Also something like this shall do

f = Interpolation[#, InterpolationOrder -> 1] & /@ Transpose@data;
Show[{ParametricPlot3D[Through[f[t]], {t, 1, Length@data}],
Graphics3D[{PointSize[Large], Point@data}]}]

-
OKay it connects them, but now I lose my points. I want to see the dots as well. You see what I mean? – Hawk Apr 7 '13 at 18:20
@jak See edit, please – Dr. belisarius Apr 7 '13 at 18:23
There is also one other problem, which I will edit in OP. – Hawk Apr 7 '13 at 18:26
see edit 10 chat – Hawk Apr 9 '13 at 0:10