MATLAB: How to create a 3D cone

digital image processingimage analysisimage processingimage segmentationMATLABmatlab codermatlab functionsignal processing

i am trying like this
m=1000;
n=1000;
r=2;
h=5;
for i=1:m
for j=1:n
I(i,j)=1/3*pi*r^2*h*i/n;
end
end
imshow(I)
but i am not getting result,please help

Best Answer

r = linspace(0,2*pi) ;
th = linspace(0,2*pi) ;
[R,T] = meshgrid(r,th) ;
X = R.*cos(T) ;
Y = R.*sin(T) ;
Z = R ;
surf(X,Y,Z)