How to plot a cone via fsurf?
이전 댓글 표시
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.
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Surfaces and Volumes에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!