function animate_pendulum(time,sols,L,dL,Omega)

for i=1:length(time)
xp(i) =    (L+dL*sin(Omega*time(i)))*sin(sols(i,1));
yp(i) =  - (L+dL*sin(Omega*time(i)))*cos(sols(i,1));
end
maxv = max(max(xp),max(yp));
minv = min(min(xp),min(yp));
%if (minv>0) minv = -0.1; end
%if (maxv<0) maxv = 0.1; end
dx = 0.505*(maxv-minv);
xcen = 0.5*(maxv+minv);
ycen = 0.5*(maxv+minv);
figure;
[m,n] = size(sols);
for i = 1:m
    clf
    ylim([ycen-dx ycen+dx]);
    xlim([xcen-dx xcen+dx]);
    axis square;
    hold on;
    plot(xp(i),yp(i),'ro','MarkerSize',11,'MarkerFaceColor',[1,0,0]);
    plot([0,xp(i)],[0,yp(i)],'LineWidth',2)
    pause(0.05)
end

end