-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
new .slx with a preload script and TLE
- Loading branch information
Showing
4 changed files
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
%Initialise J2 | ||
|
||
clc | ||
clear | ||
|
||
mu = 398600.4415; % Earth’s gravitational parameter [km^3/s^2] | ||
R_earth = 6378.137 ; % Earth radius [km] | ||
J2 = 0.0010836; | ||
we = 360*(1 + 1/365.25)/(3600*24); % Earth's rotation [deg/s] | ||
fname = 'STUDSAT2like.txt'; % TLE file name | ||
% Open the TLE file and read TLE elements | ||
fid = fopen(fname, 'rb'); | ||
while ~feof(fid) | ||
% Reading TLE File | ||
L1 = fscanf(fid,'%23c%*s',1); | ||
L2 = fscanf(fid,'%d%6d%*c%5d%*3c%*2f%f%f%5d%*c%*d%5d%*c%*d%d%5d',[1,9]); | ||
L3 = fscanf(fid,'%d%6d%f%f%f%f%f%f%f%f',[1,9]); | ||
epoch = L2(1,4)*24*3600; % Epoch Date and Julian Date Fraction | ||
Db = L2(1,5); % Ballistic Coefficient | ||
i = L3(1,3); % Inclination [deg] | ||
RAAN = L3(1,4); % Right Ascension of the Ascending Node [deg] | ||
e = L3(1,5)/1e7; % Eccentricity | ||
omega = L3(1,6); % Argument of periapsis [deg] | ||
M = L3(1,7); % Mean anomaly [deg] | ||
n = L3(1,8); % Mean motion [Revs/day] | ||
% Orbital parametres | ||
a = (mu/(n*2*pi/(24*3600))^2)^(1/3); % Semi-major axis [km] | ||
% T=3600*24; | ||
T = 2*pi*sqrt(a^3/mu); % Period in [min] | ||
rp = a*(1-e); | ||
h = (mu*rp*(1 + e))^0.5; % Angular momentum | ||
E = keplerEq(M*pi/180,e,eps); | ||
theta = acos((cos(E) -e)/(1 - e*cos(E)))*180/pi; % [deg] True anomaly | ||
|
||
E = 2*atan(tand(theta/2)*((1-e)/(1+e))^0.5); | ||
M = E - e*sin(E); | ||
t0 = M/(2*pi)*T; | ||
end |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
STUDSAT2 LIKE | ||
1 99999U 17212.27083333 -.00000681 00000-0 -73551-4 0 00002 | ||
2 99999 097.7872 145.0781 0010609 271.6166 088.3814 14.88384880000013 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
function E = keplerEq(M,e,eps) | ||
En = M; | ||
Ens = En - (En-e*sin(En)- M)/(1 - e*cos(En)); | ||
while ( abs(Ens-En) > eps ) | ||
En = Ens; | ||
Ens = En - (En - e*sin(En) - M)/(1 - e*cos(En)); | ||
end; | ||
E = Ens; | ||
end |