I need to plot the orbits of four different planets on the same graph in Matlab. The code below works for each plot individually, creating the orbit plot that I want. However, when I put all the codes together like I do below, I get a plot that looks like 4 straight lines going in random directions.
ro=[0,0,1.50e11];vo=[0,2*pi*ro(3)/(365*24*60*60),0];for n=1:730 delt_t=24*60*60 [r,v]= orbits3d(ro,vo,delt_t) plot3(r(1),r(2),r(3), 'go') hold on ro=r vo=vendro=[0,0,2.28e11];vo=[2*pi*ro(2)/(365*24*60*60*1.88),0,0];for n=0:1:730*1.88 delt_t=24*60*60 [r,v]= orbits3d(ro,vo,delt_t) plot3(r(1),r(2),r(3), 'ro') hold on ro=r vo=vendro=[0,0.58e11,0];vo=[2*pi*ro(1)/(365*24*60*60*0.241),0,0];for n=1:730*.241 delt_t=24*60*60 [r,v]= orbits3d(ro,vo,delt_t) plot3(r(1),r(2),r(3), 'bo') hold on ro=r vo=vendro=[0,1.08e11,0];vo=[0,0,2*pi*ro(3)/(365*24*60*60*0.615)];for n=1:730*.615 delt_t=24*60*60 [r,v]= orbits3d(ro,vo,delt_t) plot3(r(1),r(2),r(3), 'mo') hold on ro=r vo=vendHow can I make it so each orbit appears on the graph without affecting the other graphs?Thanks
Best Answer