Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations KootK on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hold on problem with 4 plots

Status
Not open for further replies.

zemerlin

Civil/Environmental
Mar 22, 2006
1
hi this may seem a basic question...
i have a geometry project and i have to draw an elliptical cone and elliptical cylinder.
I want first to draw the generators then use meshgrid as if to cover my skeleton.
But my elliptical cone "skeleton" won't draw with the others, each time it removes previous plots. And if i put it in head of script then it blocks the rest...
This is the script i am using: thank you for your help.

axis([-20 20 -20 20 -40 40]);
axis equal;
hold on;

a=20; % focal axe half-lenght for cone
b=12; % non focal axe half-axe for cone
k=[-1:1/30:1];
h=[-20:20/30:20];
for v=0:pi/100:2*pi
z=20*ones(1,size(y,2));
x=a*cos(v);
y=b*sin(v);
plot3(x,y,z)
pause (10^(-20))
end
% draws the upper ellipse of the elliptical cone
for v=0:pi/100:2*pi
z=-20*ones(1,size(y,2));
x=a*cos(v);
y=b*sin(v);
plot3(x,y,z)
pause (10^(-20))
end
% draws the lower ellipse of the elliptical cone
a2=16; % focal axe half-lenght for cylinder
b2=10; % non focal axe half-lenght for cylinder
u=[-20:20/30:20];
for v=0:pi/30:2*pi
y=b2*sin(v);
z=a2*cos(v);
x=u;
plot3(x,y,z,'r')
pause(0.01)
end
% draws the generators of the ellipctical cylinder
for v=0:pi/30:2*pi
z=u;
x=a*k*cos(v);
y=b*k*sin(v);
plot3(x,y,z)
pause(0.05)
end
% draws the generators of the elliptical cone (here's my problem)

Thank you for your time



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor