function delay_1abr(a,b,r,p,q)

% One-delay z - a - b*e^(-r*z)
% p = x_max, q = y_max

h=p/100;
k=q/50;
x(1) = 0;
y(1) = q;
u1(1) = x(1)-a-b*exp(-r*x(1))*cos(r*y(1));
w1(1) = y(1)+b*exp(-r*x(1))*sin(r*y(1));
for i=2:101
    x(i) = 0;
    y(i) = y(i-1)-k;
    u1(i) = x(i)-a-b*exp(-r*x(i))*cos(r*y(i));
    w1(i) = y(i)+b*exp(-r*x(i))*sin(r*y(i));
end
for i=102:201
    x(i) = x(i-1)+h;
    y(i) = -q;
    u2(i-101) = x(i)-a-b*exp(-r*x(i))*cos(r*y(i));
    w2(i-101) = y(i)+b*exp(-r*x(i))*sin(r*y(i));
end
for i=202:301
    x(i) = p;
    y(i) = y(i-1)+k;
    u3(i-201) = x(i)-a-b*exp(-r*x(i))*cos(r*y(i));
    w3(i-201) = y(i)+b*exp(-r*x(i))*sin(r*y(i));
end
for i=302:401
    x(i) = x(i-1)-h;
    y(i) = q;
    u4(i-301) = x(i)-a-b*exp(-r*x(i))*cos(r*y(i));
    w4(i-301) = y(i)+b*exp(-r*x(i))*sin(r*y(i));
end
plot(u1,w1,'b-',u2,w2,'r-',u3,w3,'g-',u4,w4,'m-');grid

% delay_1abr(-0.5,-2,1,3,4)
