close all; clear all; clc theta=linspace(0,20*pi,5000); M1=1.988*10^30; M2=2*M1 e=(30-20)/(30+20); c=(30*10^6*10^3)*(1-e); r=c./(1+e*cos(4.3*theta)); r1=M2/(M1+M2)*r; r2=-M1./(M1+M2)*r; [x,y]=pol2cart(theta,r); [x1,y1]=pol2cart(theta,r1); [x2,y2]=pol2cart(theta,r2); x1=x1/10^8 y1=y1/10^8 x2=x2/10^8 y2=y2/10^8 [A,B,C]=sphere(50); Size1=15*M1/10^30; Size2=15*M2/10^30; figure %surf(x,y,C);set(gcf,'color',[1,1,1]) %F=Axis for i= 1:length(theta) surf(Size1.*A+x1(i),Size1.*B+y1(i),Size1.*C); hold on surf(Size2.*A+x2(i),Size2.*B+y2(i),Size2.*C); plot(x1(1:i),y1(1:i),'b',x2(1:i),y2(1:i),'g') hold off set(gcf,'color',[1,1,1]) set(gca,'color',[1,1,1]) axis off Axis([-200,200,-200,200,-200,200]) pause(10^-100) end %% [x,y,z]=sphere(100); surf(5*x+5,5*y+5,5*z+5)