3 Downloads
Updated 26 Aug 2005
No License
XYZ2GRAV - computes the gravitational acceleration vector at a specified ECEF location using the JGM2 gravitational ellipsoid only. Higher-order gravity terms (the "gravity anomaly") are ingnored. Only the pure ellipsoid is used.
[gx,gy,gz] = XYZ2GRAV(x,y,z)
x, y, z = Earth-Centered-Eacrth-Fixed (ECEF) cartesian coordinates (meters)
gx,gy,gz = components of gravitational acceleration in ECF (meters/sec^2)
NOTES:
(1) x,y,z may be scalars, vectors, or matrices but must have the same size and shape
(2) gx,gy,gz will have the same size/shape as x,y,z
(3) Only the ellipsoidal portion of the JGM-2 gravity model is used here.
(4) Points inside the earth will return gravity vectors, but will be higher in magnitude than physical reality since mass "above" the point is not removed from consideration; i.e., the ellipsoidal gravitational field surrounds a point at the center of the earth. The strength of the field increases as one gets closer to that central point.
(5) If all inputs are zero, then NaN is returned.
(6) Source of initial formulas:
www.colorado.edu/ASEN/asen3200/labs/ASEN3200_LabO3_2005.pdf
(7) The gx & gy formulas were written in a more explicit form to prevent divergence when the x-coordinate is zero.
(8) The calculation was accelerated by precomputing some values.
(9) No warranty; use at your own risk.
Version 1.0 - Initial writing. Michael Kleder, August 2005
Michael Kleder (2021). Ellipsoidal Gravity Vector (https://www.mathworks.com/matlabcentral/fileexchange/8359-ellipsoidal-gravity-vector), MATLAB Central File Exchange. Retrieved .
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Create scripts with code, output, and formatted text in a single executable document.
The desciption is a little misleading. It actuall computes gravitional acceleration, including the J2 pertubution, given a satellite's coordinates in earth centered interial (ECI), and not ECF. If the position is in ECF, you need to also compute the effect of the coriolis and centripetal accelerations, due to the rotating frame. This requires both the satellite position and velocity vectors.
It is very nice example