wrapping a value onto 3D surface of an irregular pipe
조회 수: 8 (최근 30일)
이전 댓글 표시
Dear all,
I have generated the following 3D plot showing the surface of an irregular cylinder.
The plot was created from the known X, Y and Z coordinate (the data is attached to this post in three separate *.txt files)
I used the following iteration to generate the plot:
xori = load('Xhole.txt');
yori = load('Yhole.txt');
depth = load('Depth.txt');
figure('Position',[100,50,800,600]);
plot3(yori,xori,-1*depth+0*xori,'color',[.5 .5 .5]);hold on
for ii = 1:length(depth)
plot3(yori(ii,:),xori(ii,:),-1*depth(ii)+0*xori(ii,:),'k-');
hold on
view([65 -90 90]);
xlabel('x');
zlabel('Depth (z)');
ylabel('y');
set(gca,'DataAspectRatio',[1 1 3.5]);
axis tight
set(gca,'XTickLabel',[]);
set(gca,'YTickLabel',[]);
end
I got two questions now:
Is there any other workaround to generate a similar plot that is more elegant than the above code?
Suppose I have the 4th-dimension, i.e. values at each X-Y-Depth pair, how do I wrap the value onto the 3D plot? I am thinking of generating a plot shown below:
댓글 수: 0
채택된 답변
darova
2020년 3월 4일
편집: darova
2020년 3월 4일
Here is the succesfull solution
X = load('Xhole.txt');
Y = load('Yhole.txt');
Z = load('Depth.txt');
Z = repmat(Z,[1 180]);
R = hypot(X,Y);
cla
surf(X,Y,Z,'edgecolor','none','facecolor','interp');
alpha(0.4)
hold on
surf(X./R*5,Y./R*5,Z,'cdata',R);
hold off
axis vis3d
caxis([min(R(:)) max(R(:))])
Colored according to radius
추가 답변 (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!