parametric helix around a line

2 次查看(过去 30 天)
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

采纳的回答

Sulaymon Eshkabilov
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

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Animation 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by