Mathematica How to Plot x[t] Versus y[t] in Mathematica?

Click For Summary
To plot the functions x[t] and y[t] against each other in Mathematica, the correct approach is to use the ParametricPlot function. The suggested syntax is ParametricPlot[{x[t], y[t]} /. sol, {t, 0, 10}], which ensures that the functions are properly formatted without unnecessary layers of brackets. Additionally, using Trace[] can help identify any issues in the original plotting attempt, providing insight into why it may not have worked initially.
yashar
Messages
31
Reaction score
0
hi
i solve numerically two coupled equation and obtain two function x[t] and y[t].

how i plot x[t] versus y[t] so that horizontal axis to be x[t] and vertical axis to be y[t].

here is the notebook of mathematica
http://www.mediafire.com/?g4sa3zi630vi8nl

thanks
 
Last edited by a moderator:
Physics news on Phys.org
Compare
{x[t] /. sol, y[t] /. sol}
with
{x[t], y[t]} /. sol
and see that what you are doing has an extra layer of {} around your functions that ParametricPlot objects to.

So
ParametricPlot[{x[t], y[t]} /. sol, {t, 0, 10}]
should work for you.

It might be educational to track down exactly what happened and why it didn't work.
Trace[] could help you do that.
 

Similar threads

  • · Replies 4 ·
Replies
4
Views
4K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 13 ·
Replies
13
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 9 ·
Replies
9
Views
2K