3-D surface plot for vectors x1,y1,z1,x​2,y2,z2...​.......xn,​yn,zn

1 visualizzazione (ultimi 30 giorni)
I want to plot the vectors in 3 D surface.
I used plot3(x1,y1,z1,x2,y2,z2......xn,yn,zn) but I am getting lines in 3-D.
Can you please tell me how to plot like surface in 3 dimension for n vectors for 3 axes, i.e. x1,y1,z1,x2,y2,z2............xn,yn,zn.
Thanks.

Risposta accettata

Walter Roberson
Walter Roberson il 30 Giu 2012
Plot a surface in 3 dimension for n vectors? Probably not. In general, the choice of surface would be ambiguous and thus arbitrary. The situation is not much different from the problem of constructing a surface from a point-cloud.
For example, let x1, y1 be a circle, and let x2, y2 be a circle in a parallel plane, "aligned" (i.e., the line connecting the centers of the two circles is normal to both planes.) What is the surface? Is it a cylinder? Maybe. But maybe the actual surface is two cones joined at the point half way between the two centers. Can you prove otherwise just given the vectors?
  6 Commenti
Amit
Amit il 30 Giu 2012
Sorry,but I tried to findout how to do with so many vetors in help, but I mnot getting how to construct the representation of the triangles that tirmesh() requires for its input
Walter Roberson
Walter Roberson il 30 Giu 2012
Modificato: Walter Roberson il 1 Lug 2012
X = [x1(:); x2(:); x3(:); x4(:); ...; xn(:)];
Y = [y1(:); y2(:); y3(:); y4(:); ...; yn(:)];
Z = [z1(:); z2(:); z3(:); z4(:); ...; zn(:)];
NV = n; %number of vectors
VL = length(x1);
V = (1:((NV-1)*VL)-1).';
T1 = [V, V+1, V+VL];
Now, T1 will be a partial "tri" matrix built up like
|\|\|\
- - -
Except that T1 is a bit too large: it has the entries that correspond to using the top point in each vector as the lower-left corner and the bottom point in the next vector as if it were the upper-left corner. These entries must be removed from T1, which can be done by removing each (VL+1)'st row.
After that you need to construct T2, in very much the same pattern, except being the upper-right triangles, like
/|/|/|
- - -
and remove the extra rows in it.
Then T = [T1;T2] would be the "tri" representation, and x, y and z would be the coordinate vectors to use for the X, Y, Z arguments for trimesh()

Accedi per commentare.

Più risposte (0)

Tag

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by