How to plot a cone via fsurf?
Show older comments
Hello! I am experiencing some problems when trying to plot a cone in ML using the fsurf function.
When using meshgrid and surf everything works as expected (the height of the cone is supposed to be three times the radius, that's where the formula for z comes from):
radius = 2;
r = linspace(0,radius);
phi = linspace(0,2*pi);
[R, PHI] = meshgrid(r,phi);
X = R .* cos(PHI)
Y = R .* sin(PHI)
Z = -3*R + 3 * radius;
surf(X,Y,Z);
I have this example for a cylinder in ML:
R = 2;
xZ = @(t,z) R*cos(t);
yZ = @(t,z) R*sin(t);
zZ = @(t,z) z;
fsurf(xZ, yZ, zZ);
This example works fine but I guess I have not really understood how everything comes together or how these anonymus functions work. I think this example can be modified to plot a cone by altering zZ but I do not really know how. Maybe someone can give me a push in the right direction.
Accepted Answer
More Answers (0)
Categories
Find more on Surfaces and Volumes in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!