# Gravitational Acceleration at a given latitude and altitude

Theory

The gravitational acceleration that an object experiences decreases the further it gets from the center of the Earth. The gravitational acceleration at sea level at any point on the Earth’s surface can be calculated using the International Gravity formula:

When at sea level the gravitational acceleration only changes with respect to the latitude and not the longitude. The Earth is not a smooth surface and as such we need to be able to calculate this acceleration at altitudes with respect to sea level. We can modify the previous formula so that an altitude (h) in meters can be used to calculate the correct gravitational acceleration.

Application

This function will take in a latitude and an altitude in meters. It will return a number representing the gravitational accelerations whose units are in

`function gravitationalAcceleration(latitude, altitude){    var lat = DegToRad(latitude);        return 9.780327*(1+0.0053024*Math.pow(Math.sin(lat),2)-0.0000058*Math.pow(Math.sin(2*lat),2))-0.000003086*altitude;}`

Listing 1 Gravitational Acceleration function