function chaos3
% tato funkce animuje kmitavy pohyb bodu s linearne rostouci frekvenci
n = 40;
dL = 0.5;
L = n*dL;
u = zeros(n,1);
y = linspace(0,L,n);
om = 1+nlinspace(0,1,n);

I1 = 1:2:n;
I2 = 2:2:n;
figure('position',[300 50 100 fix(50*L)-100])
hold on;
tisk1 = plot(u(I1),y(I1),'marker','o','markerfacecolor','b','markersize',20*dL,'linestyle','none');
tisk2 = plot(u(I2),y(I2),'marker','o','markerfacecolor','r','markersize',20*dL,'linestyle','none');
axis equal;
axis([-1.3 1.3 -dL L+dL]);
axis off

t = 0;
dt = 0.02;
while 1
    u = sin(om*t);
    set(tisk1,'Xdata',u(I1));
    set(tisk2,'Xdata',u(I2));
    drawnow;
    t = t + dt;
end


function y = nlinspace(a,b,n)
x = linspace(0,1,n);
y = x;
y = a + y*(b-a);