# Need help with parametric plot of coupled differential equations

Posted 8 years ago
6397 Views
|
5 Replies
|
3 Total Likes
|
 Hey guys,I'm in my last year of my physics degree, and part of my dissertation project involves mathematica, modelling the orbital behaviour of a spacecraft using Ion propulsion.I have 2 coupled differential equations being solved, r''(t) and o''(t), in an NdSolve function (o is pheta in my case, modelling the change in angular momentum). It solves this with no problem, and plots the results fine. My next step is to attain a parametric plot, in which my 2 functions are cos(o)r and sin(o)r, to get the trajectory of my spacecraft along its journey. I have attemped to copy the syntax in the "get help" section and the when evaluated, it just returns a blank graph. What am i doing wrong!? ParametricPlot[{Evaluate[r[t] /. TotalThrust]* Evaluate[Cos[o[t]] /. TotalThrust], Evaluate[r[t] /. TotalThrust]* Evaluate[Sin[o[t]] /. TotalThrust]}, {t, 0, 10}, PlotRange -> All] (TotalThrust is the label given to my NDSolve function)Thanks in advance!Mike
5 Replies
Sort By:
Posted 8 years ago
 Unfortunately i need help again!It seems trivial on paper, however im struggling to get it in terms of code.Based on my ODE solutions, i now need to find the value for time t such that r(t) = 5.2. I assume its a simple piece of code, but im having trouble getting it to work.Thanks again!
Posted 8 years ago
 Wow, that actually worked perfectly, thanks alot man!
Posted 8 years ago
 Try not to use Evaluate. It isn't needed. So the input to your plotting function is: {(r[t]*Cos[o[t]] /. TotalThrust), (r[t]*Sin[o[t]] /. TotalThrust)} Evaluate this and look at the result. It's a list of lists. That is r[t]*Cos[o[t]] /. TotalThrust produces a list. Lists are those curly brackets. To get rid of them use  r[t]*Cos[o[t]] /. TotalThrust[] as shown in the article linked in the previous post. ParametricPlot[{(r[t]*Cos[o[t]] /. TotalThrust[]), (r[t]*Sin[o[t]] /. TotalThrust[])}, {t, 0, 10}] 
Posted 8 years ago
 It's hard to tell without the code. Can you try making a really super simple example of the kind of thing you're trying to do and post it? Let's ignore the Evaluate statements. They shouldn't be doing anything to the code anyway. What is the output of this command? r[t] /. TotalThrust Is it a list? It's probably not supposed to be a list. Usually you need to run First or Part to make sure you don't have a list. Also, take a quick look at this tutorial. http://support.wolfram.com/kb/12505
Posted 8 years ago
 Hey,Thanks for the reply, i've simplified my code and attached it to this post, if you could find the errors that would be fab! I'm pretty sure its not returning a list, but i could be wrong, i'm not confident at all with Mathematica.CheersMike Attachments: