How to plot and create a Gravity-Altitude graph?

I have been tasked to create or make a gravitational force-altitude graph from the surface to the top of the atmosphere. However, I am confused and I do not know how to start it because I don't have anything yet aside from the essential variables to be used such as the equation to get the gravity at any latitude, the equatorial radius, and other needed constant variables and a code (acquired from Google) that seemingly fails. Can anyone help me start?
By the way, this is the code:
function [ g ] = Gravity( z )
% this function used to get g at any altitude
%% inputs:
% z : the altitude above the earth (km)
%% outputs:
% g : the gravity at altitude z
g0 = 9.81; % m/s
Re = 6378; % km
g = g0*Re^2/(Re+z)^2; % m/s^2
end

답변 (1개)

KSSV
KSSV 2021년 3월 19일

1 개 추천

You need to input z values....Do you have those values along with lat, lon?
You may check the below example with dummy data.
clc; clear all ;
x = -10:1:10 ; nx = length(x) ; % lat
y = -10:1:10 ; ny = length(y) ; % lon
[X,Y] = meshgrid(x,y) ; % mesh
z = randi(1000,ny,nx) ; % random altitudes within 1000 units
% this function used to get g at any altitude
%% inputs:
% z : the altitude above the earth (km)
%% outputs:
% g : the gravity at altitude z
g0 = 9.81; % m/s
Re = 6378; % km
g = g0*Re^2./(Re+z).^2; % m/s^2
surf(X,Y,g)

댓글 수: 4

Thank you for answering!
With respect and utmost appreciation, can I just ask again how can I just (1) select a specific lat and lon say 10° lat and 128° lon (2) as well as to not have a code than randomize altitudes rather a code that creates a 10 km interval from 0 to 100 km altitude.
Response is utterly appreciated.
KSSV
KSSV 2021년 3월 19일
편집: KSSV 2021년 3월 19일
What I have shown you is a just a dummy data, you can extend the same to your data. For a single point, it is striaght forward:
clc; clear all ;
x = 10 % lat
y = 128 ; % lon
z = value; % your altitude at the point
% this function used to get g at any altitude
%% inputs:
% z : the altitude above the earth (km)
%% outputs:
% g : the gravity at altitude z
g0 = 9.81; % m/s
Re = 6378; % km
g = g0*Re^2./(Re+z).^2; % m/s^2
g
Oh, you're a life saver. Thank you very much!
KSSV
KSSV 2021년 3월 19일
Thanks is accepting/ voting the answer....

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Earth and Planetary Science에 대해 자세히 알아보기

질문:

2021년 3월 19일

댓글:

2021년 3월 19일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by