Cylinder with top code
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Joshua Papworth
am 13 Mär. 2019
Beantwortet: Star Strider
am 13 Mär. 2019
The code below creates a full cylinder with radius 1 and height 1.
I was wondering what lines 3 and 4 actually do to the cylinder- I don't understand how it changes it into that shape.
figure(5)
[x,y,z] = cylinder([0,1,1,0],100);
z([1,2],:)=0;
z([3,4],:)=1;
mesh(x,y,z)
0 Kommentare
Akzeptierte Antwort
Star Strider
am 13 Mär. 2019
Those lines create flat upper and lower surfaces. The upper and lower surfaces otherwise would appear conical.
The easiest way to see that is simply to ‘comment them out’:
figure(5)
[x,y,z] = cylinder([0,1,1,0],100);
% z([1,2],:)=0;
% z([3,4],:)=1;
mesh(x,y,z)
Then restore them to get the desired figure.
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Surface and Mesh Plots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!