This should give you some ideas on where to start:
w = 2;
h = 5;
d = 1/4;
verts = [-w -h -d; ...
w -h -d; ...
-w h -d; ...
w h -d; ...
-w -h d; ...
w -h d; ...
-w h d; ...
w h d];
faces = [3 4 8 7; ...
4 2 6 8; ...
2 1 5 6; ...
1 3 7 5; ...
7 8 6 5; ...
1 2 4 3];
g = hgtransform;
patch('Vertices',verts,'Faces',faces,'FaceColor',[.75 .75 .75],'Parent',g)
view(3)
box on
axis vis3d
daspect([1 1 1])
for x=linspace(0,2*pi,50)
for y=linspace(0,2*pi,50)
for z=linspace(0,2*pi,50)
g.Matrix = makehgtform('xrotate',x,'yrotate',y,'zrotate',z);
drawnow
end
end
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/173171/image.png)
end