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!

