m = 40; % number of steps per animation N = 1500; % number of points on each half a = []; aa = []; c = []; a = [0.5*rand(N,1) rand(N,1)]; % black points aa = [0.5 + 0.5*rand(N,1) rand(N,1)]; % green points a = [a; aa]; % concatenate them c = []; for i = 1:N, c(i) = 'k'; % color the points c(i+N) = 'g'; end c = 'kg'; figure(1) clf title('Baker''s transformation'); f = 100; for r = 1:10, b = [2*a(:,1) 0.5*a(:,2)]; % locations after squash f = animatepointsgif(a,b,c,16,f); clf title('Baker''s transformation'); bb = [mod(b(:,1),1) b(:,2)+0.5*(a(:,1) > 0.5)]; f = animatepointsgif(b,bb,c,6,f); clf title('Baker''s transformation'); a = bb; end