wrapping a value onto 3D surface of an irregular pipe

8 vues (au cours des 30 derniers jours)
BeeTiaw
BeeTiaw le 4 Mar 2020
Commenté : BeeTiaw le 6 Mar 2020
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:

Réponse acceptée

darova
darova le 4 Mar 2020
Modifié(e) : darova le 4 Mar 2020
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

Plus de réponses (0)

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by