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!

