Clear Filters
Clear Filters

parametric helix around a line

2 views (last 30 days)
Mel A
Mel A on 8 Jan 2023
Commented: Mel A on 10 Jan 2023
Hi
I have a line,'l' specifided by two points
P1 = [0,0,0]
P2 = [1,3,-5]
The P2 was calculated using rotation matrix (R).
How could I create a parametric helix around 'l' please
Thanks

Accepted Answer

Sulaymon Eshkabilov
Sulaymon Eshkabilov on 8 Jan 2023
Here is a solution:
% Step 1. Solve for the unknowns of the helix equations using the given P2 point
P1 = [0,0,0];
P2 = [1,3,-5];
% The unknowns: x = r*cos(t), y=r*sin(t), z=c*t.
syms r c t
Eq1 = 1==r*cos(t);
Eq2 = 3==r*sin(t);
Eq3 = -5==c*t;
Sol = solve(Eq1, Eq2, Eq3);
% Solutions
c = double(Sol.c)
c = 2×1
2.6419 -4.0031
r=double(Sol.r)
r = 2×1
-3.1623 3.1623
t=double(Sol.t)
t = 2×1
-1.8925 1.2490
% Step 2. Plot the helix taking a second solution
time = linspace(0, t(2), 200);
R = r(2);
C = c(2);
X = R*sin(time);
Y = R*sin(time);
Z = C*time;
plot3(X,Y,Z, 'ro-', 'markerfacecolor', 'y'), grid on
xlabel('x(t)'), ylabel('y(t)'), zlabel('z(t)')
axis tight

More Answers (0)

Categories

Find more on Animation in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!