필터 지우기
필터 지우기

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

추가 답변 (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