3-D surface plot for vectors x1,y1,z1,x2,y2,z2..........xn,yn,zn
5 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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.
0 commentaires
Réponse acceptée
Walter Roberson
le 30 Juin 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 commentaires
Walter Roberson
le 30 Juin 2012
Modifié(e) : Walter Roberson
le 1 Juil 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()
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Surface and Mesh Plots dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!