function animate_planets(t,sols)

scrsize = get(0,'ScreenSize');
nn = min(scrsize(3:4));
x0 = scrsize(3)/2-nn/3;
y0 = scrsize(4)/3;
figure1 = figure('Position',[x0,y0,2*nn/3,2*nn/3]);

xmax = max(max(max(sols(:,5)),max(sols(:,3))),max(sols(:,1)));
xmin = min(min(min(sols(:,5)),min(sols(:,3))),min(sols(:,1)));
ymax = max(max(max(sols(:,6)),max(sols(:,4))),max(sols(:,2)));
ymin = min(min(min(min(sols(:,6)),sols(:,4))),min(sols(:,2)));

dx = 0.1*(xmax-xmin)+0.5;
dy = 0.1*(ymax-ymin)+0.5;

for i = 1:length(t)
    clf
    axes1 = gca;

    plot(axes1,sols(1:i,5),sols(1:i,6),'LineWidth',2,'LineStyle',...
    ':','Color',[0 0 1]);
    ylim(axes1,[ymin-dy ymax+dy]);
    xlim(axes1,[xmin-dx xmax+dx]);
    hold on
    plot(axes1,sols(1:i,1),sols(1:i,2),'LineWidth',2,'LineStyle',':',...
    'Color',[1 0 0]);
    plot(axes1,sols(1:i,3),sols(1:i,4),'LineWidth',2,'LineStyle',':',...
    'Color',[0 1 0]);
    plot(axes1,sols(i,1),sols(i,2),'ro','MarkerSize',11,'MarkerFaceColor','r');
    plot(axes1,sols(i,3),sols(i,4),'ro','MarkerSize',11,'MarkerFaceColor','g');
    plot(axes1,sols(i,5),sols(i,6),'ro','MarkerSize',11,'MarkerFaceColor','b');

    pause(0.1);   
    
end

end
