-
Notifications
You must be signed in to change notification settings - Fork 3
/
orbit_simulator.m
53 lines (37 loc) · 1.2 KB
/
orbit_simulator.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
% Orbit Simulator
% Input: Satellite TLE Data
% Output: 3D Plot & Ground Trace of Satelite Orbit
% Author: Samanvay Karambhe 2016
% Clear everything
clc;
clear;
close all;
%% Initialisation
% Add other folders to path
addpath('./module_conversion','./tle_data',...
'./functions');
% Load constants
constants()
% Deconstruting TLE Data
satTLE = deconstruct_TLE('OrbocommTLE.txt');
% Define Sim Time (1 Day)
simTime = 86400;
%% Simulating the orbit
% Obtain the Position and Velocity array for the LEO Satellite over 5900s
[ECIPos,ECIVel,trueAnomaly] = orbitSimulate(satTLE,simTime);
% Print Orbital period
fprintf('The orbital Period of the LEO Satellite is %.0f seconds \n',...
satTLE.orbitPeriod);
% Convert ECI Coordinates to ECEF Coordinates
ECEFPos = eci2ecef(ECIPos, 1:simTime);
% Convert Satellite Coordintes from ECEF to LLHLD
LLHGDPos = ecef2llhgd(ECEFPos);
%% Find the simulated period of the satellite
% orbitPeriodArray = findPeriod(ECEFPos,1:simTime);
%% Plot ground trace and 3D plots
makePlot(ECIPos,LLHGDPos)
% Export ECEF Data for Satellite
% save('ECIPos.mat','ECIPos')
%% Export Classic Parameters vector
% Export the orbitParameters
% save('trueAnomaly.mat','trueAnomaly')