필터 지우기
필터 지우기

Rotating Earth with moving body plot in real-time

조회 수: 9 (최근 30일)
Ayden Clay
Ayden Clay 2019년 2월 2일
편집: Ayden Clay 2019년 2월 2일
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));
end
figure('Name','Earth Positions','NumberTitle',1)
[X,Y,Z]=ellipsoid(0,0,0,Re,Re,Rp);
globe = surf(X*Re,Y*Re,-Z*Rp);
cdata = imread('https://upload.wikimedia.org/wikipedia/commons/thumb/c/cd/Land_ocean_ice_2048.jpg/1024px-Land_ocean_ice_2048.jpg');
set(globe, 'FaceColor', 'texturemap', 'CData', cdata, 'EdgeColor', 'none');
set(gcf,'Color','k')
set(gca, 'visible', 'off')
axis equal
plot3(Xs,Ys,Zs)

답변 (0개)

카테고리

Help CenterFile Exchange에서 Earth and Planetary Science에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by