## Creating a Helix Spiral

Hans123

### Hans123 (view profile)

님이 질문을 제출함. 19 Aug 2019
최근 활동 Hans123

### Hans123 (view profile)

님이 댓글을 추가함. 19 Aug 2019
Bruno Luong

### Bruno Luong (view profile)

님이 답변을 채택함.
I want to create a helix sprial. I wish to have control over changing the radius of the spiral, the gap between each layer and the height of the spiral. How would I do that?
I obtained the code below from MATLAB's Documentation however I am not familiar with it. If you can explain how st and ct works that would be helpful too.
clc; clear; close all
t = 0:pi/50:10*pi;
st = sin(t);
ct = cos(t);
plot3(st,ct,t)
grid on

로그인 to comment.

## 답변 수: 1

### Bruno Luong (view profile)

on 19 Aug 2019
Edited by Bruno Luong

### Bruno Luong (view profile)

on 19 Aug 2019

r = ...
gap = ...
t = (2*pi/gap)*(0:0.001:10);
st = r*sin(t);
ct = r*cos(t);

표시 이전 댓글 수: 2
Hans123

### Hans123 (view profile)

on 19 Aug 2019
If I want to make the height (black line) be independent of the gap, how would I change the code?
Because I have 3 user requested variables - Radius, Gap, Height
Bruno Luong

### Bruno Luong (view profile)

on 19 Aug 2019
gap=5 % blue distance
d=30 % black distance
r = 2;
z=linspace(0,d,1000);
t=(2*pi/gap)*z;
x=r*cos(t)
y=r*sin(t)
plot3(x,y,z)
Hans123

### Hans123 (view profile)

on 19 Aug 2019
works exactly as I want it to, thank you for the help!

로그인 to comment.

Translated by