# 3d representation of GPS coordinates

9 views (last 30 days)
marianoc84 on 22 May 2011
[EDIT: 20110525 10:45 CDT - clarify - WDR]
I have 3 vectors, x, y, z. Three different vector's element represent the position of point in space (e.g. x[0], y[0], z[0] contain info about first point position).
Now I need to realize a 3d representation of the entire set of point, it should look like that: http://www.svgopen.org/2008/papers/38-Visualization_of_GPS_tracks_with_SVG/09_gpstrackanalyse-net_3d.png
Can someone help me??? What function should be useful?

Ben Mitch on 22 May 2011
If you want something looking just like the figure you posted, you'll be wanting to use patch(), I suspect. The following might be a starting point (stealing Jarrod's x/y/z source data)...
close all
t = 0:0.1:pi;
x = sin(t);
y = cos(t);
z = t+0.1;
for n = 1:length(z)-1
x1 = x(n);
x2 = x(n+1);
y1 = y(n);
y2 = y(n+1);
z1 = z(n);
z2 = z(n+1);
p = patch([x1 x2 x2 x1], [y1 y2 y2 y1], [0 0 z2 z1], [0 1 1]);
set(p, 'LineStyle', 'none');
plot3([x1 x2], [y1 y2], [z1 z2], 'b-', 'linewidth', 3);
hold on
end
view(3);
light
use image() to lay down a photo on the axis, first, if you want. look at light() if you want to make it look slicker. for annotations as shown, you'll need text() as well.
##### 2 CommentsShowHide 1 older comment
Ben Mitch on 25 May 2011
here's some crude code for that. see "help patch" for details.
ci = (z2 - min(z)) / (max(z) - min(z)) * 64 + 1;
p = patch([x1 x2 x2 x1], [y1 y2 y2 y1], [0 0 z2 z1], ci);

Jarrod Rivituso on 22 May 2011
Hmmm... does stem3 help?
t = 0:0.01:pi;
x = sin(t);
y = cos(t);
z = t;
stem3(x,y,z)
marianoc84 on 22 May 2011
It seems.
The really hard question (for me) is: how should I join with a segment single stem's point, how should I color the surface obtained joining the the points?