Effacer les filtres
Effacer les filtres

How to write code for parametric equation

53 vues (au cours des 30 derniers jours)
Eric Jackson
Eric Jackson le 31 Mai 2015
Réponse apportée : isku le 25 Juil 2020
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 commentaire
John D'Errico
John D'Errico le 31 Mai 2015
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.

Connectez-vous pour commenter.

Réponses (2)

Walter Roberson
Walter Roberson le 31 Mai 2015
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 le 25 Juil 2020
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)]

Catégories

En savoir plus sur Programming dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by