HSGlib.orbital Wiki
A gnuplot library to plot keplerian orbits and more
Status: Beta
Brought to you by:
hsgaspar
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);
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)
Suppose you have a main output file 'sim01.dat' of a numeric simulations whose columns are set like:
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'