How to write code for parametric equation

52 次查看(过去 30 天)
Hi, I need help to write the code to plot the curve and tangent line for t in the interval of [0, 2π].
This is the question:
Parametric equation of a curve is given by r(t)= 〈4 cos(t) ,2 sin(t) 〉. Determine the tangent vector at t = 2. What is the parametric equation of the tangent line at t = 2?
  1 个评论
John D'Errico
John D'Errico 2015-5-31
This is not a MATLAB question, but a basic one of mathematics. So can you tell us what the equation of that line would be in terms of mathematics? If you could, it would be trivial to write it in MATLAB. Therefore, you don't have a MATALB question at all. Time to review your notes or your textbook.

请先登录,再进行评论。

回答(2 个)

Walter Roberson
Walter Roberson 2015-5-31
x = r(t](1), y = r(t)(2), dx/dt = d r(t)(1) /dt, dy/dt = d r(t)(2) / dt. So calculate those to get a formula for dx/dt and dy/dt. Then evaluate at the given time t = 2 to get dx and dy as constants. Any tangent line must have the same slope as dy/dx (which are now constants), and as well must pass through r evaluated at the given t, becoming constants. You are now reduced to the task of finding the right intercept to complete y = m*x + b where m = known dy/dx and x = known r(t=2)(1) and y = known r(t=2)(2).
The "parametric equation" of the tangent line at a specific time makes no sense to me. The parametric equation of the tangent line at a symbolic time t would make sense and is easily answered using the above reasoning.

isku
isku 2020-7-25
My Code:
>> clear; syms t real;
r = [ 4*cos(t), 2*sin(t) ]
Dr = diff(r)
>> subs( Dr,t,2) % substitute at t=2
ans =
[ -4*sin(2), 2*cos(2)]

类别

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

Community Treasure Hunt

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

Start Hunting!

Translated by