Rotating Earth with moving body plot in real-time

17 views (last 30 days)
I'm trying to plot a real-time simulation of a body moving across the Earths surface. I currently have the individual components working, i.e. a moving body, and a rotating Earth and I've even managed to plot the final products of each with one another, however, when I try to combine the two and plot the slowly rotating and moving pieces all together I get a range of errors, most stemming from the "getframe" command. So far here is my code
%% Sim time
[t,dt] = simTime('dt',1,'tf',82800);
%% Earth Parameters
Re = 6378137; %Radius of the Earths equator.
Rp = 6356752; %Radius of Earth between poles.
%% Initial Position
latitude = 51.5074*pi/180 ;
longitude = -0.1278*pi/180;
altitude = 1e5;
[Xs,Ys,Zs] = initialPos(latitude,longitude,altitude);
% Movement of surface reference
longdot = 7.192250e-5;
latdot = 0;
altdot = 0;
%% Earth initialization
for i=1:size(t,2)-1
latitude(i+1,1) = eulerint(latitude(i,1),latdot,dt);
longitude(i+1,1) = eulerint(longitude(i,1),longdot,dt);
altitude(i+1,1) = eulerint(altitude(i,1),altdot,dt);
[Xs(i+1,1),Ys(i+1,1),Zs(i+1,1)] = initialPos(latitude(i+1,1),longitude(i+1,1),altitude(i+1,1));
figure('Name','Earth Positions','NumberTitle',1)
globe = surf(X*Re,Y*Re,-Z*Rp);
cdata = imread('');
set(globe, 'FaceColor', 'texturemap', 'CData', cdata, 'EdgeColor', 'none');
set(gca, 'visible', 'off')
axis equal

Answers (0)


Find more on Earth and Planetary Science 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!