Skip to content

Instantly share code, notes, and snippets.

@wyojustin
Created May 3, 2020 13:24
Show Gist options
  • Save wyojustin/893c070b32cb3f3c6a353f3c24045e16 to your computer and use it in GitHub Desktop.
Save wyojustin/893c070b32cb3f3c6a353f3c24045e16 to your computer and use it in GitHub Desktop.
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