z = [pi/3;0];   g = 9.81;   r = 50;

t = 0;          h = 0.1;   t_end = 5000;

figure(1)
close(1)
figure(1)

while t < t_end
    k1 = [z(2);-g/r*sin(z(1))];
    zpom = z + h/2*k1;
    k2 = [zpom(2);-g/r*sin(zpom(1))];
    %z  = z + h*k1;
    z  = z + h*k2;
    t  = t+h;
    
    x =  r*sin(z(1));
    y = -r*cos(z(1));
    
    plot(0,0,'x','color','black')
    hold on
    plot([0;x],[0;y],'-','color','black')
    plot(x,y,'o','color','blue')
    hold off
    
    axis([-50 50 -50 50]);
    axis square
    pause(0.00000001)
end

