Model a simple circular satellite orbit in time
13 views (last 30 days)
Show older comments
Michal Sleszynski
on 2 Feb 2020
Edited: James Tursa
on 26 May 2021
So Im essentially trying to graph an orbit which will be a circle on a polar plot it is to represent the motion of a 500kg satellite when there is no force applied to it. Im neglecting the fact it should be falling over time for now. However my code does not produce the desired result so any input would be aprriciated , thank you all in advance
clc;
clear all;
G = 6.673e-11; %Gravitational constant
M = 5.98e24; %mass of earth in (kg)
ra = 100000; %orbit distance in (m)
r = 6.37e6 + ra; %total radius of orbit in (m)
m = 500; % mass satelite (kg)
a = (G*M)/(r^2); % check for acceleration
v_orb = sqrt((G*M)/r); % orbital velocity (m/s)
T = sqrt(((4*(pi^2))*r^3)/(G*M)); % period (s)
%lets graph it for the period in steps of 150 to reduce the computation
simt = T;
for t = 1:150:simt
v_o(t) = sqrt((G*M)/r);% array of velocity corresponding to time in steps of 150 .. should not change and be 1x34 - but ERROR
rn(t) = 6.37e6 + ra; % array of radius corresponding to time in steps of 150 .. should not change and be 1x34 - but ERROR
disp(t) % goes from 1 to 5101 in steps of 150
%%% create array of the form 1x34 corresponding to t ???? %%%
end
figure
plot(t, v_o); xlabel('Simulation Time', 'FontSize', 12);
ylabel('Velocity', 'FontSize', 12);
grid; %%% expecting a graph of straight line %%%
figure
plot(t, rn); xlabel('Simulation Time', 'FontSize', 12);
ylabel('Radius', 'FontSize', 12);
grid; %%% expecting a graph of straight line %%%
%%% take the points of radius and time convert to polar coordinates and plot %%%
%%% expecting a circle as satellite moves around the orbit of constant radius in a sice of time of the period%%%
%[theta,rho] = cart2pol(t,rn);
theta = atan2(rn,t);
rho = sqrt((t.^2)+(rn.^2));
theta= theta*(180/pi); % to degrees
figure
polarplot(theta,rho)
title('Orbit')
0 Comments
Accepted Answer
James Tursa
on 3 Feb 2020
Since you are setting up a circular orbit, just scale the time by the period to get theta. E.g., since one period would be an angle of 2pi,
theta = 2*pi * t / T;
Then just use that and rn for your plot.
2 Comments
More Answers (2)
See Also
Categories
Find more on Reference Applications in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!