필터 지우기
필터 지우기

I want to sketch the parametric euqations lies on the cone, but the cone is so small and the lines are sparser than it should be.

조회 수: 1 (최근 30일)
parametric euqations is x=tcost, y=tsint, z=t
and the euqation of the cone is z^2=x^2+y^2
my code looks like this
t=linspace(-2*pi,2*pi,100);
x=t.*cos(t);
y=t.*sin(t);
z=t;
plot3(x,y,z);
hold on;
u=linspace(-2*pi,2*pi,100);
v=linspace(-2*pi,2*pi,100);
[u,v]=meshgrid(u,v);
x=cos(u).*sin(v);
y=cos(u).*cos(v);
z=cos(u);
surf(x,y,z)
I can't find any mistake in my code.
Answer is that the line should be denser.
What is the problem of my code?
I appreciate any help. Thank you.

채택된 답변

Star Strider
Star Strider 2020년 9월 19일
Scale the size of the cone up by multiplying its variables with some appropriate constant (that I call a ‘Magnification Factor’ here).
Example —
t=linspace(-2*pi,2*pi,100);
x=t.*cos(t);
y=t.*sin(t);
z=t;
plot3(x,y,z, '-r', 'LineWidth',2);
hold on;
u=linspace(-2*pi,2*pi,100);
v=linspace(-2*pi,2*pi,100);
[u,v]=meshgrid(u,v);
x=cos(u).*sin(v);
y=cos(u).*cos(v);
z=cos(u);
mf = 6; % ‘Magnification Factor’
surf(x*mf,y*mf,z*mf, 'EdgeColor','none')
grid on
axis('equal')
producing:
.
  댓글 수: 4
수정 이
수정 이 2020년 9월 24일
Thank you very much. I really aprreciate your help!
I understood it finally.
Have a nice day :)

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Pulsed Waveforms에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by