フィルターのクリア

parametric helix around a line

2 ビュー (過去 30 日間)
Mel A
Mel A 2023 年 1 月 8 日
コメント済み: Mel A 2023 年 1 月 10 日
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
Sulaymon Eshkabilov 2023 年 1 月 8 日
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
  1 件のコメント
Mel A
Mel A 2023 年 1 月 10 日
Thanks very much @Sulaymon Eshkabilov

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeAnimation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by