How to write code for parametric equation

52 ビュー (過去 30 日間)
Eric Jackson
Eric Jackson 2015 年 5 月 31 日
回答済み: isku 2020 年 7 月 25 日
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 Center および File ExchangeProgramming についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by