Click here to Skip to main content
15,908,768 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
Hi,
how can i create a Cone without using matlab builtin function?
Posted
Updated 23-Dec-13 4:51am
v2
Comments
[no name] 23-Dec-13 9:22am    
Read the manuals and google first. Nobody here is keen on doing the work for you!
m.r.m.40 23-Dec-13 9:24am    
lol.
Richard MacCutchan 23-Dec-13 10:48am    
The same way you create a sphere: by writing some code.
m.r.m.40 23-Dec-13 12:54pm    
very clever,
Thank you.
you can read the comments under the previous question you may get something.
Richard MacCutchan 23-Dec-13 13:00pm    
I don't need anything.

1 solution

here it is,
code of a circle then by changing the z as the circle height and changing the r as its radius i can create a cone( at least something like it ).
VB
r=1
teta=-pi:0.01:pi
x=r*cos(teta);
y=r*sin(teta);
z=zeros(1,numel(x));
plot3(x,y,z);
hold on

% ----------------------------------- %

for i = 1 : 20
    z=z+0.05;
    r=r-0.05;
    x=r*cos(teta);
    y=r*sin(teta);
    plot3(x,y,z);
    hold on
end
hold off
 
Share this answer
 
Comments
m.r.m.40 1-Jan-14 23:47pm    
http://www.codeproject.com/Questions/701032/math-equation-MATLAB

well this is the cone and for creating a sphere using same formula i need to give the circle a little slope instead of giving it height( means the same center(x,y,z) but different angle )

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900