Modify code of straight circular cone to get a slate one
8 views (last 30 days)
Show older comments
R = 1; %// radius
H = 3; %// height
N = 100; %// number of points to define the circumference
[x, y, z] = cylinder([R 0], N);
mesh(x, y, H*z)
does a straight circular cone. How to modify to get a slate one like

Comments are welcome.
Thanks
2 Comments
Answers (1)
John D'Errico
on 14 Apr 2023
Assuming you mean a skewed cone, this is simple to do. You already know how to use the cylinder function.
help cylinder
A cone is simple.
First, what is a cylinder? It is a circle, translated along the z axis, so the same circle at any value of z. Now, we can create a cone, by scaling the x and y values that come out, by multiplying by z. Nicely, cylinder actually does that for you.
R = 1; %// radius
H = 3; %// height
N = 100; %// number of points to define the circumference
[x, y, z] = cylinder([R 0], N);
mesh(x,y,z)
But a skewed cone, is now one that also has x and y translated over, also as a function of z.
x = x + z/2;
mesh(x,y,z)
See Also
Categories
Find more on Surface and Mesh Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
