フィルターのクリア

Plotting the Tangent Line

4 ビュー (過去 30 日間)
Jay Gersten
Jay Gersten 2015 年 10 月 29 日
コメント済み: Elioth Daniel 2022 年 10 月 13 日
I am trying to plot the tangent line to a curve given by the parametric equations x = sin(t), y = cos(t), z = t
I have no idea where to start, but here is the code I have for the equations.
t=linspace(0,2*pi,50);
x=cos(t); y=sin(t); z=t;
plot3(x,y,z, 'r', 'LineWidth', 2);
view([2 2 2]); grid on

回答 (1 件)

Tushar Sinha
Tushar Sinha 2015 年 11 月 2 日
Hi Jay,
In your case, the parameterized helix curve is given by the equations:
t=linspace(0,2*pi,50);
x=cos(t); y=sin(t); z=t;
The tangent direction < u,v,w > at point < x,y,z > can be calculated as the gradient of the above parameterized equations:
u = -sin(t)
v = cos(t)
w = 1
Now, any tangent line on this curve passing through a point < x,y,z > will be in direction of < u,v,w >. This modifies the above equations as follows:
u = x y
v = y + x
w = z + 1
In order to draw a line passing through a given point < x,y,z > and in the gradient direction, Let s = linspace(-0.75, 0.75, 50).
The following code will draw the tangents at every 10th point on the helix curve:
function tangentCurve
t=linspace(0,2*pi,50);
x=cos(t); y=sin(t); z=t;
figure;
plot3(x,y,z,'r');hold on;
view([2 2 2]); grid on
s = linspace(-0.75, 0.75, 50);
for i = 1:10:length(x)
u=@(s)x(i)-y(i)*s;
v=@(s)y(i)+x(i)*s;
w=@(s)z(i)+1*s;
plot3(u(s),v(s),w(s));
end
end
I hope this helps resolve the issue.
Thanks,
Tushar
  1 件のコメント
Elioth Daniel
Elioth Daniel 2022 年 10 月 13 日
Thank you, This helped me very much!

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

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by