How to plot satellite orbits around the Earth? (combining plots)

10 views (last 30 days)
I have a script that produces the earth on a 3D set of axis and another that produces the orbit of a satellite in the form of a ring. (plot3 was used to model the satellite's trajectory). Does anyone know how I can combine the plot of the earth and that of the orbit trajectory?

Answers (1)

KSSV
KSSV on 16 Mar 2018
Use hold on and then plot both on the same figure. Simple... :)
  4 Comments
Christopher Maraj
Christopher Maraj on 16 Mar 2018
This is the m file for the earth plot
Re = 6.37e6;
load('earth_topo.mat');
figure(1);
[x,y,z] = sphere(50);
s = surf(Re*x/1e6,Re*y/1e6,Re*z/1e6); % create a sphere
s.CData = topo; % set color data to topographic data
s.FaceColor = 'texturemap'; % use texture mapping
s.EdgeColor = 'none'; % remove edges
s.FaceLighting = 'gouraud'; % preferred lighting for curved surfaces
s.SpecularStrength = 0.4; % change the strength of the reflected light
grid on; box on; axis equal;
axis(8*[-1 1 -1 1 -1 1]);
xlabel('x (10^6 m)'); ylabel('y (10^6 m)'); zlabel('z (10^6 m)'); title('Earth');
set(gca,'LineWidth',1,'FontSize',14, ...
'Xtick',[-8:4:10],'Ytick',[-8:4:10],'Ztick',[-8:4:8]);
end
Christopher Maraj
Christopher Maraj on 16 Mar 2018
This is the code for the plot, which at the moment only has the orbit rings on a 3d axis and no earth.
[Xo,Yo,Zo,Uo,Vo,Wo,tstart,tend,maxthrust] = read_input('satellite_data.txt',1);
[T,X,Y,Z,U,V,W] = satellite(Xo,Yo,Zo,Uo,Vo,Wo,tstart,tend,maxthrust);
plot3(X,Y,Z,'b')
hold on;
scatter3(X(tend),Y(tend),Z(tend),'filled')
end

Sign in to comment.

Categories

Find more on CubeSat and Satellites 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!