% baker(n,c) iterates the baker's map on n points with starting locations c % Enter baker(1000,1) at the Matlab command prompt to run it. function [void] = baker(n,c) switch c case 1, x = 0.5*rand(1000,1); y = 0.5*rand(1000,1); case 2, x = 0.25 + 0.25*rand(1000,1); y = 0.5*rand(1000,1); case 3, x = rand(1000,1); y = x + 0.25*rand(1000,1); case 4, [x,y] = meshgrid(0:0.04:1, 0:0.04:1); x = 0.5*reshape(x,prod(size(x)),1); y = 0.5*reshape(y,prod(size(x)),1); case 5, [x,y] = meshgrid(0:0.04:1, 0:0.04:1); x = reshape(x,prod(size(x)),1)/4; y = reshape(y,prod(size(x)),1)/4; case 6, [x,y] = meshgrid(0:0.01:1, 0:0.01:1); x = reshape(x,prod(size(x)),1)/3; y = reshape(y,prod(size(x)),1)/3; case 7, x = 1/3; y = 1/3; case 8, x = [1/3 1/6]'; y = [1/3 1/6]'; end for i=1:100, plot(x, y, '.', 'markersize', 12); axis([0 1 0 1]); drawnow; pause X = mod(2*x,1); Y = (y + (x > 0.5))/2; x = X; y = Y; end