Menu

Examples

Helton da Silva Gaspar

Example1: What is the speed of the ISS

load 'lib_orbital.plt'
mu = liborb_muear;
a  = (6371.0 + 400)*1e3;
e  = 0.0;
f  = 0.0;
print vrad   = vr(mu,a,e,f);
print vtrans = vt(mu,a,e,f);
print mag(vrad,vtrans,0.0);

Example2: Hohmann transfer from LEO to GEO

load 'lib_orbital.plt'
mu   = liborb_muear;
aleo = (6371.0 + 100)*1e3;
ageo = ( mu * (24*3600/2/pi)**2 )**(1./3)
ahoh = ( aleo+ageo )/2.0;
ehoh = ( ageo-aleo )*0.5/ahoh;

set parametric
set trange [0:1]

print "Initial Delta V:"
print vt(mu,ahoh,ehoh,0)-vt(mu,aleo,0,0)

print "Final Delta V:"
print vt(mu,ageo,0,0)-vt(mu,ahoh,ehoh,pi)


plot x_pq(aleo,0,0,2*pi*t),   y_pq(aleo,0,0,2*pi*t),\
     x_pq(ahoh,ehoh,0,pi*t),  y_pq(ahoh,ehoh,0,pi*t),\
     x_pq(ahoh,ehoh,pi,pi*t), y_pq(ahoh,ehoh,pi,pi*t),\
     x_pq(ageo,0,0,2*pi*t),   y_pq(ageo,0,0,2*pi*t)

Exemple3: Avoiding secondary files with orbital elements

Suppose you have a main output file 'sim01.dat' of a numeric simulations whose columns are set like:

  1. time
  2. x body 2
  3. y body 2
  4. z body 2
  5. vx body 2
  6. vy body 2
  7. vz body 2
  8. x body 3
  9. y body 3
  10. ...
    You can plot any of the orbital elements you want directly from your main output file:
load 'lib_orbital.plt'

#parameter of mass in adequate units to the coordinates:
 mu = 39.487639;

plot 'sim01.dat' u 1:(rv2a(mu,$2,$3,$4,$5,$6,$7)) title 'Semimajor axis'

Or even for a body 3-centric frame of reference

load 'lib_orbital.plt'

#parameter of mass in adequate units to the coordinates:
mu = liborb_G*(m1+m2)

plot 'sim01.dat' u 1:(rv2O(mu,$2-$8,$3-$9,$4-$9,$5-$11,$6-$12,$7-$13)) title 'Long. of ascending node'

Related

Wiki: Home