Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

MatLab: Write a program to calculate the acceleration due to the Earth\'s gravit

ID: 3815322 • Letter: M

Question

MatLab: Write a program to calculate the acceleration due to the Earth's gravity in 500 km increments at heights from 0 km to 40,000 km above the surface of the Earth. Print out the results in a table of height versus acceleration with appropriate labels, including the units of the output values. Plot the data as well. Mostly need help with printing out the results in a table of height versus acceleration

1. The acceleration due to the Earths gravity at any hieght "h" above the surface of the Earth is given by the equation (1) (R h) where G is the gravitational constant (6.672 x 10 11 N m2/ M is the mass of the earth kg2, (5.89 x 1024 kg), R is the mean radius of the Earth (6371 km) and h is the height above the Earth's surface. If M is measured in kg and R and h im meters, then the resulting acceleration will be in units of meters per seconds squared. Write a program to calculate the acceleration due to the Earth's gravity in 500 km increments at heights from 0 km to 40,000 km above the surface of the Earth. Print out the results in a table of height versus acceleration with appropriate labels, including the units of the output values. Plot the data s well.

Explanation / Answer

%g=-G*(M/((R+h)*(R+h)))

%G=6.672*10^-11 Nm^2/kg^2

%M=5.89*10^24 kg

%R=6371 km

%h=0 to 40,000km

G=6.672*10^-11;

M=5.89*10^24;

R=6371;

i=0;%count to store the index

for h=0:500:40000

i=i+1;%increment index to store in vcotr next value

H(i)=h;

g(i)=-G*(M/((R+h)*(R+h)));

end

fprintf(' The Accelaration chart table ');

fprintf('Height(kms) Accelaration(km/sec^2) --------------------------------------------------- ');

for i=1:length(H)

fprintf('%dkms %dkms/sec^2 ',H(i),g(i));

end