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 CenterFile Exchange에서 Programming에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by