The International Space Station (ISS) is a habitable artificial satellite in low Earth orbit.In this example we implement algorithm to plot ISS ground track. Same algorithm could be used for any satellite. Read more
clear all; clc; % Earth topographic map figure(1); xwidth = 820; ywidth = 420; hFig = figure(1); set(gcf,'PaperPositionMode','auto') set(hFig, 'Position', [100 100 xwidth ywidth]) hold on; grid on; axis([0 360 -90 90]); load('topo.mat','topo','topomap1'); contour(0:359,-89:90,topo,[0 0],'b') axis equal box on set(gca,'XLim',[0 360],'YLim',[-90 90], ... 'XTick',[0 60 120 180 240 300 360], ... 'Ytick',[-90 -60 -30 0 30 60 90]); image([0 360],[-90 90],topo,'CDataMapping', 'scaled'); colormap(topomap1); ylabel('Latitude [deg]'); xlabel('Longitude [deg]'); title('ISS ground track'); R_e = 6378; % Earth's radius mu = 398600; % Earth’s gravitational parameter [km^3/s^2] J2 = 0.0010826; we = 360*(1 + 1/365.25)/(3600*24); % Earth's rotation [deg/s] % ISS Orbital Elements /Source: NASA rp = 401 + R_e; % [km] Perigee Radius ra = 420 + R_e; % [km] Apogee Radius theta = 310; % [deg] True anomaly RAAN = 125.6271; % [deg] Right ascension of the ascending node i = 51.6475; % [deg] Inclination omega = 176.4787; % [deg] Argument of perigee a = (ra+rp)/2; % Semimajor axis e = (ra -rp)/(ra+rp) ; % Eccentricity h = (mu*rp*(1 + e))^0.5; % Angular momentum T = 2*pi*a^1.5/mu^0.5; % Period dRAAN = -(1.5*mu^0.5*J2*R_e^2/((1-e^2)*a^3.5))*cosd(i)*180/pi; domega = dRAAN*(2.5*sind(i)^2 - 2)/cosd(i); % Initial state [R0 V0] = Orbital2State( h, i, RAAN, e,omega,theta); [ alfa0 ,delta0 ] = R2RA_Dec( R0 ); scatter(alfa0,delta0,'*k'); ind = 1; eps = 1E-9; dt = 20; % time step [sec] ti = 0; while(ti <= 3*T); E = 2*atan(tand(theta/2)*((1-e)/(1+e))^0.5); M = E - e*sin(E); t0 = M/(2*pi)*T; t = t0 + dt; M = 2*pi*t/T; E = keplerEq(M,e,eps); theta = 2*atan(tan(E/2)*((1+e)/(1-e))^0.5)*180/pi; RAAN = RAAN + dRAAN*dt ; omega = omega + domega*dt; [R V] = Orbital2State( h, i, RAAN, e,omega,theta); % Considering Earth's rotation fi_earth = we*ti; Rot = [cosd(fi_earth), sind(fi_earth),0;... -sind(fi_earth),cosd(fi_earth),0;0,0,1]; R = Rot*R; [ alfa(ind) ,delta(ind) ] = R2RA_Dec( R ); ti = ti+dt; ind = ind + 1; end scatter(alfa,delta,'.r'); text(280,-80,'smallsats.org','Color',[1 1 1], 'VerticalAlignment','middle',... 'HorizontalAlignment','left','FontSize',14 );
Orbital2State? Where’s the function defined?
https://smallsats.org/2013/01/17/orbital-elements-from-the-state-vector/
Here is the post about how to get an orbital parameters from state vectors. Let me know if you face difficulties. In a future you can use the search button on top to look for the missing function. In most cases you will find it in previous posts 🙂 , Cheers !!
That link is converting a state vector to orbital elements, but this script uses a function that you wrote that converts orbital elements to the state vector.
Can we get the source for that?
Here you go… https://smallsats.org/2013/01/17/state-vectors-r-v-from-orbital-elements/
J2 in the code has a typo. It would be 0.0010826
There is a typo in J2, which would be 0.0010826
Thank you for an input !