Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
from pylab import *
from numpy import *
Me = 5.98E+24 # KG
G = 6.67E-11 # KG^2/(MS^2)
Re = 6378137 # M
Rp = 6356752 # M
DEG = pi/180
lat = arange(-90, 91, 1) * DEG
alt = arange(0, 100 * 1000, 100) # meters
r = sqrt(((Re ** 2 * cos(lat)) ** 2 + ((Rp ** 2 * sin(lat)) ** 2))/
((Re * cos(lat)) ** 2 + ((Rp * sin(lat)) ** 2)))
d = r[newaxis,:] + alt[:,newaxis]
g = (G * Me)/d**2
pcolormesh(lat / DEG, alt/1000., g)
colorbar()
title(r'Gravitational Acceleration [$\frac{m}{s^2}$]')
xlabel('Latidude [deg]')
ylabel('Altitude [km]')
show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment