Help plotting a circular orbit
显示 更早的评论
Hi so basically i would like to be able to produce a circular graph of sattelite position around earth. The code attached below starts with acceleration and use Eulers method to integrate once for velocity and again for displacement. The code works and produces results i am just unsure how to convert the outputs into a circular graph that updates displacement around earth as a result of the calculated velocity.
Code:
clear all
clc
G = 6.6743*10^-11; %Gravitational Constant, Units: m^3 kg^-1 s^-2
Mc = 5.972*10^24; %Mass of central body (earth), Units: kg
rE = 6371; %Radius of earth, Units: Km
height = 4000 %Altitude of sattelites orbit, Units: km
r = height + rE; %Radius of circular orbits, Units: km
mu = 3.986004418*10^5; %Earths Gravitational parameter, Units: km^3s^-2
x_initial = 0;
v_initial = 12000; %km/h
dt = 0.1;
t_vector = 0:dt:100000;
x(1) = x_initial;
v(1) = v_initial;
%%Math working out
%Fx = -G*x*(Mc/r^3);
%a = Fx/Mc
%a = (-G*x)/r^3
%a = -5.9833e-23*x m/s^2
%v(t) = 12000 + a*t
%y(t) = r + 12000t + 0.5a*t^2
x_initial = 0;
v_initial = 12000;
x(1)=x_initial;
v(1)=v_initial;
for i=1:length(t_vector)-1
a = -G/r^3;
v(i+1) = v(i) + a*dt;
xslope = v(i);
x(i+1) = x(i)+xslope*dt;
end
figure(1)
plot(t_vector,x)
figure(2)
plot(t_vector,v)
1 个评论
Walter Roberson
2022-6-4
You need to track x and y separately.
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Satellite and Orbital Mechanics 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

