Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
T
Thomas West MSc Dissertation MATLAB Code
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Thomas West
Thomas West MSc Dissertation MATLAB Code
Commits
de208b1d
Commit
de208b1d
authored
9 months ago
by
Thomas West
Browse files
Options
Downloads
Patches
Plain Diff
Geometry and orbital coefficient calculations for an orbit.
parent
60ebf52d
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Function/geometry_calculations.m
+39
-0
39 additions, 0 deletions
Function/geometry_calculations.m
with
39 additions
and
0 deletions
Function/geometry_calculations.m
0 → 100644
+
39
−
0
View file @
de208b1d
function
[
inclination
,
RAAN
,
argument_of_periapsis
,
eccentricity
]
=
geometry_calculations
(
r
,
v
,
mu
)
% Calculate the angular momentum vector
h
=
cross
(
r
,
v
);
n
=
cross
([
0
,
0
,
1
],
h
);
n_norm
=
norm
(
n
);
h_norm
=
norm
(
h
);
% Calculate the inclination
inclination
=
acos
(
h
(
3
)
/
h_norm
);
inclination
=
rad2deg
(
inclination
);
% Convert from radians to degrees
% Calculate the Right Ascension of the Ascending Node (RAAN)
if
n_norm
~=
0
RAAN
=
atan2
(
n
(
2
),
n
(
1
));
RAAN
=
rad2deg
(
RAAN
);
% Convert from radians to degrees
if
RAAN
<
0
RAAN
=
RAAN
+
360
;
% Ensure the angle is positive
end
else
RAAN
=
0
;
% RAAN is undefined for zero inclination
end
% Calculate the eccentricity vector
r_norm
=
norm
(
r
);
v_norm
=
norm
(
v
);
e
=
(
1
/
mu
)
*
((
v_norm
^
2
-
mu
/
r_norm
)
*
r
-
dot
(
r
,
v
)
*
v
);
eccentricity
=
norm
(
e
);
% Eccentricity is the magnitude of the eccentricity vector
% Calculate the Argument of Periapsis
if
n_norm
~=
0
&&
eccentricity
>
0
argument_of_periapsis
=
acos
(
dot
(
n
,
e
)
/
(
n_norm
*
norm
(
e
)));
if
e
(
3
)
<
0
argument_of_periapsis
=
2
*
pi
-
argument_of_periapsis
;
% Correct the angle if e_z is negative
end
argument_of_periapsis
=
rad2deg
(
argument_of_periapsis
);
% Convert from radians to degrees
else
argument_of_periapsis
=
0
;
% Argument of periapsis is undefined if no inclination or eccentricity
end
end
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment