Plot the orbit of a satellite

841 views (last 30 days)
Bora K
Bora K on 9 Jan 2020
Answered: MANISH SINGH on 19 Feb 2022
Hello everyone,
I have this MATLAB function satellit(t,x,model) provides the system of differential equations for the orbit elements x = (a e i O w M) of a satellite in an Earth orbit.
I have to write a function to compute the orbit of a satellite. In this function the user should provide model initial position x(0) and flight time tf. Finally I have to plot the satellite orbit in cartesian coordinates. However I'm struggling to do it. Could anyone help me ?
function dx = satellit(t,x,model)
dx = zeros(6,1);
a = x(1); % semi-major axis [km]
e = x(2); % eccentricity
i = x(3); % inclination [rad]
O = x(4); % longitude of the ascending node [rad]
w = x(5); % argument of periapsis [rad]
M = x(6); % mean anomaly [rad]
GM = 398600.4418; % graviational parameter in km^3/s^2
R = 6378.1370; % radius at equator in km
J2 = 0.0010826267d0; % Earth's J2 (WGS-84)
J3 = -0.0000025327d0; % Earth's J3 (WGS-84)
J4 = -0.0000016196d0; % Earth's J4 (WGS-84)
ac = a*a*a;
n = sqrt(GM/ac);
Thanks in advance

Accepted Answer

Meg Noah
Meg Noah on 9 Jan 2020
Edited: Meg Noah on 28 Oct 2021
Edited 10/28/2021 - Thanks to a bug found by @Frank Epstein in the interpretation of Mdot - this is updated in TLE2OrbitalElements.m
Here you go. The attached scripts produce these plots for the International Space Station. You can supply your own TLE for the satellite of interest. This does not include atmospheric drag or solar impacts. Would you like that as well - the special perturbations applied over time? Or did you just need the basic Kepler COE -> Cartesian transformations?
Walter Roberson
Walter Roberson on 29 Oct 2021
Meg, thank you for your continued contributions on these topics!

Sign in to comment.

More Answers (2)

MANISH SINGH on 19 Feb 2022
function [P] = Orbital_period ( R )
% orbital period ( R ) calculates the orbital period of the satellite orbitting
% around the earth in seconds for radius of orbit R in meters, R is the
% total Radius of earth and height of satellite from earth
% To call this function type[ P ] = orbital period ( R )
Ge = 6.673e-11; %Earth Gravitational constant in N*m^2/kg^2;
Me = 5.98e24; %Earth Mass in Kg
P = sqrt((4*(pi^2)*R^3)/(Ge*Me));

Meysam Mahooti
Meysam Mahooti on 26 May 2021
Edited: Walter Roberson on 17 Oct 2021

Community Treasure Hunt

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

Start Hunting!