Patch error when I plot x,y,z
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Sierra
el 23 de Ag. de 2022
Comentada: Star Strider
el 24 de Ag. de 2022
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 comentarios
Respuesta aceptada
Star Strider
el 23 de Ag. de 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 comentarios
Star Strider
el 24 de Ag. de 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.
.
Más respuestas (0)
Ver también
Categorías
Más información sobre Polygons en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!