function animate_projectiles(t,sols,X0,V0)
xp = X0(1) + V0(1)*t;
yp = X0(2) + V0(2)*t;
for i = 1:length(t)
    dist(i) = sqrt((sols(i,1)-xp(i))^2+(sols(i,2)-yp(i))^2);
end
xmax = max(max(xp),max(sols(:,1)));
xmin = min(min(xp),min(sols(:,1)));
ymax = max(max(yp),max(sols(:,2)));
ymin = min(min(yp),min(sols(:,2)));
range = max(xmax-xmin,ymax-ymin)/2;
xcen = (xmax+xmin)/2;
ycen = (ymax+ymin)/2;
figure
for i = 1:length(t)
    clf    
    axes('FontSize',14);
    plot(xp(1:i),yp(1:i));
    ylim([ycen-range ycen+range]);
    xlim([xcen-range xcen+range]);

    axis square
%    axis equal
    hold on
    plot(sols(1:i,1),sols(1:i,2));
    plot(xp(i),yp(i),'ro','MarkerSize',5,'MarkerFaceColor','g');
    plot(sols(i,1),sols(i,2),'ro','MarkerSize',5,'MarkerFaceColor','r')
    pause(0.05);
end

titstr = strcat('V_0_x =',num2str(V0(1)),' V_0_y=',num2str(V0(2)));
title({titstr},'FontSize',20);
xlabel({'x'},'FontSize',16);
ylabel({'y'},'FontSize',16);

end