function animate_quadrupole(times,sols)

    [XX,YY,ZZ] = cylinder(0.1);
    XX1 = XX - 0.15;
    YY1 = YY - 0.15;
    XX2 = XX + 0.15;
    YY2 = YY + 0.15;
    figure1 = figure;
    for i=1:length(times)
        clf
     axes1 = axes('Parent',figure1,'DataAspectRatio',[1 1 1]);

     view(axes1,[-79.5 22]);
     grid(axes1,'on');
     xlim([-0.6 0.6]);
     ylim([-0.6 0.6]);
     zlim([0 1.2]);
     hold on
     surf(XX1,YY1,ZZ)
     surf(XX2,YY2,ZZ)
     surf(XX1,YY2,ZZ)
     surf(XX2,YY1,ZZ)      
     plot3(sols(1:i,1),sols(1:i,2),sols(1:i,3),...
         'LineWidth',2,'Color',[0 1 0]);
     plot3(sols(i,1),sols(i,2),sols(i,3),...
         'ro','MarkerSize',11,'MarkerFaceColor','r');
     pause(0.01)
    end
end