# 3d representation of GPS coordinates

7 次查看（过去 30 天）
marianoc84 2011-5-22
[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?

### 回答（2 个）

Ben Mitch 2011-5-22
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 个评论显示 无隐藏 无
marianoc84 2011-5-22
It sounds like more than a starting point...
There's only one open issue: how to set a colormpa rather than solid color [0 1 1]?
Ben Mitch 2011-5-25
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 2011-5-22
Hmmm... does stem3 help?
t = 0:0.01:pi;
x = sin(t);
y = cos(t);
z = t;
stem3(x,y,z)
##### 1 个评论显示 -1更早的评论隐藏 -1更早的评论
marianoc84 2011-5-22
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?

### 类别

Help CenterFile Exchange 中查找有关 Just for fun 的更多信息

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by