Azzera filtri
Azzera filtri

parametric helix around a line

2 visualizzazioni (ultimi 30 giorni)
Mel A
Mel A il 8 Gen 2023
Commentato: Mel A il 10 Gen 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

Risposta accettata

Sulaymon Eshkabilov
Sulaymon Eshkabilov il 8 Gen 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

Più risposte (0)

Categorie

Scopri di più su Animation in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by