Patch error when I plot x,y,z
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I wanted to plot the patch. but the 'z' value returns only zero in plot.
I want to plot 3 patches with same x,y value. only 'z' value changes
I attach the data and the code.
for i = 1:length(hex_3d)
patch(hex_3d{i,1},hex_3d{i,2},hex_3d{i,3});
hold on
patch(hex_3d{i,1},hex_3d{i,2},hex_3d{i,4});
patch(hex_3d{i,1},hex_3d{i,2},hex_3d{i,5});
end
Please Let me know how to solve this problem.
Thanks.
0 commentaires
Réponse acceptée
Star Strider
le 23 Août 2022
LD = load(websave('hex_3d','https://www.mathworks.com/matlabcentral/answers/uploaded_files/1105925/hex_3d.mat'))
hex_3d = LD.hex_3d;
figure
hold on
for i = 1:length(hex_3d)
patch(hex_3d{i,1},hex_3d{i,2},hex_3d{i,3},'b');
patch(hex_3d{i,1},hex_3d{i,2},hex_3d{i,4},'g');
patch(hex_3d{i,1},hex_3d{i,2},hex_3d{i,5},'r');
end
hold off
grid on
view(30,30)
.
4 commentaires
Star Strider
le 24 Août 2022
This is the best I can do —
LD = load(websave('hex_3d','https://www.mathworks.com/matlabcentral/answers/uploaded_files/1105925/hex_3d.mat'))
hex_3d = LD.hex_3d;
% figure
% hold on
% for i = 1:length(hex_3d)
% patch(hex_3d{i,1},hex_3d{i,2},hex_3d{i,3},'b')%, 'EdgeColor','none');
% patch(hex_3d{i,1},hex_3d{i,2},hex_3d{i,4},'g')%, 'EdgeColor','none');
% patch(hex_3d{i,1},hex_3d{i,2},hex_3d{i,5},'r')%, 'EdgeColor','none');
% end
% hold off
% grid on
% view(30,30)
x = cell2mat(hex_3d(:,1))*[1 1]
y = cell2mat(hex_3d(:,2))*[1 1]
z = [cell2mat(hex_3d(:,3)) cell2mat(hex_3d(:,5))] % Only Need The Upper & Lower Since They All Appear To Be The Same
figure
surf(x, y, z, 'EdgeColor','k')
grid on
view(30,45)
colormap(summer)
% shading('interp')
There appear to be a lot of extra horzontal lines and some incomplete ‘columns’ (they look like basalt columns to me), however since I do not understand the data, I am not certain how to eliminate them, or otherwise deal with them.
.
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Polygons dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!