wrapping a value onto 3D surface of an irregular pipe

4 ビュー (過去 30 日間)
BeeTiaw
BeeTiaw 2020 年 3 月 4 日
コメント済み: BeeTiaw 2020 年 3 月 6 日
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:

採用された回答

darova
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 ExchangeSurface and Mesh Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by