create helix with radius 2 withone revolution in xy plane and one unit in z direction

답변 (2개)

Ameer Hamza
Ameer Hamza 2020년 10월 12일
편집: Ameer Hamza 2020년 10월 12일

1 개 추천

Try this
r = 2;
t = linspace(0, 10*pi, 1000);
x = r*cos(t);
y = r*sin(t);
z = t/(2*pi);
plot3(x, y, z);
grid on

댓글 수: 5

Adil Asif
Adil Asif 2020년 10월 12일
can you explain how is it one revolution in x y
axis
Ameer Hamza
Ameer Hamza 2020년 10월 12일
If you want just one revolution then change 't' to
t = linspace(0, 2*pi, 1000);
t control the number of revolutions. 2*k*pi will create k revolutions.
Adil Asif
Adil Asif 2020년 10월 12일
Got it thankyouuu and can you tell what about moving one unit in z direction?
John D'Errico
John D'Errico 2020년 10월 12일
편집: John D'Errico 2020년 10월 12일
What happens after 2*pi radians? (Hint: x,y return to their original position, because sin and cos are periodic with period 2*pi.)
Therefore, at t = 0, we start the curve, where z=0. When do x and y return to the same spot? Again, at t = 2*pi. What is the value of z at that "time"?
z = (2*pi)/(2*pi) = 1
So z increments by EXACTLY one unit in z, every 2*pi units of time.
Ameer Hamza
Ameer Hamza 2020년 10월 12일
@Adil, as John explained, you will move a unit distance along the z-axis for each 2*pi increment in 't'.

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

KSSV
KSSV 2020년 10월 12일
편집: KSSV 2020년 10월 12일

0 개 추천

r = 2 ;
c = 10 ;
th = linspace(0,2*pi*c,500) ;
x = r*cos(th) ;
y = r*sin(th) ;
z = c*th ;
plot3(x,y,z)

카테고리

도움말 센터File Exchange에서 Resizing and Reshaping Matrices에 대해 자세히 알아보기

태그

질문:

2020년 10월 12일

편집:

2020년 10월 12일

Community Treasure Hunt

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

Start Hunting!

Translated by