p = 0;
q = pi;
n=0;
while p<q,
    %for p = 0 : pi/ 5 : 2*pi
    clf('reset')
    n=rand(1);
    p = p + pi/10+n;
    q = q + pi/10;
    
    t = 0 : pi/100.0:2*pi;
    u0=1; 
    v0 = 1;
    A = 4;
    B = 2;
    u = u0 + A / 2 * sin(t);
    v = v0 + B / 2 * cos(t);
    
    
    
    plot(u, v, u0, v0, '+r', 'LineWidth', 2);
    grid on
    axis equal

    hold on        
    
    k = u0 + A / 2 * sin(p);
    l = v0 + B / 2 * cos(p);
    plot(k, l, 'blackp-', 'LineWidth', 7);
    
    
    hold on
    m = u0 - A / 2 * sin(q-pi);
    n = v0 + B / 2 * cos(q);
    plot(m, n, 'yellowp-', 'LineWidth', 7);
    
    pause(0.5)
    
end

msgbox('Black caught yellow. Program of Maxim Kudelin finished successfully','Опа чирик!!!', 'modal')




