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

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)

Use hold on and then plot both on the same figure. Simple... :)

4 Comments

Thank you for your answer, Although, I'm not sure how to call the plot of the earth (contained within a separate m-file) in order to use hold on. Would you happen to know how to do this?
Show us the m file/ code.
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
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 Earth and Planetary Science in Help Center and File Exchange

Asked:

on 16 Mar 2018

Commented:

on 16 Mar 2018

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!