Read how to compute apogee and perigee from TLE data:
http://www.satobs.org/seesat/Dec-2002/0197.html(Links to an external site.)
Add anapogeeandperigeefunction to the last programming assignment.
Each function takes two input parameters:
1)mean_motion
2)eccentricity
Print the same output as the previous assignment, plus the apogee and perigee. Look up some of the satellites online to check your results.
Also test the program by printing the perigee/apogee for all the recently launched satellites.
You will of course need to add some code to extract the mean_motion and eccentricity from TLE line 2.
Remenber you can check results by searching online fornorad
to find the correct results.
clear all clc sat_list=string(splitlines(webread("https://celestrak.com/NORAD/elements/geo.txt"))); fprintf("----------------------------------------------------------------------------------------------------\n") fprintf("******************The satelites which have 45 degree or more inclination***************************\n") fprintf("----------------------------------------------------------------------------------------------------\n") for i=1:3:length(sat_list)-1 name=sat_list(i); tle2 = split(sat_list(i+2)); in_deg=str2num(tle2(3)); if in_deg >= 45 fprintf("%s\n",name); e0=str2num(tle2(5)); n0=str2num(tle2(8)); a = (8681663.653 / n0) ^ (2/3); hp = a*(1 - e0) - 6371; ha = a*(1 + e0) - 6371; fprintf("hp = %s km and ha = %s km, both rounded to the nearest km\n",num2str(hp),num2str(ha)) end end