Hi everyone!
recently I've been making an orbit propagator where I plot an orbit around the Earth by plotting 2-body problem using ode45 and animate the orbit around the Earth.. but what happens is the rotation of Earth will be animated first and then the animation of the orbit begins after the Earth stops… is there any way I can make both happen at the same time?
the code:
Map = imread('earthmap.jpg');Re = 6378; %km
[X, Y, Z]= sphereEarth = surf(Re*X, Re*Y, -Re*Z)set(Earth,'FaceColor','texturemap','Cdata',Map,'EdgeColor','none')set(gcf,'Color','k')set (gca,'Color','k')axis equalrotE = 360/24; %deg per hour
%Earth rotating around Z axis.
Ndays = Period/86400; %number of hours
tr = Ndays*24; %one day
for ir = 1:1:tr+1 %since time starts from 1 not 0
rotate(Earth,[0 0 1],rotE);Anim = getframe(gca);endhold oncomet3(xv,yv,zv) %xv yv zv are the values I get from solving the 2-body problem which I didn't include here
Best Answer