3-D surface plot for vectors x1,y1,z1,x2,y2,z2..........xn,yn,zn
조회 수: 1 (최근 30일)
이전 댓글 표시
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
채택된 답변
Walter Roberson
2012년 6월 30일
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
Walter Roberson
2012년 6월 30일
편집: Walter Roberson
2012년 7월 1일
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()
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!