function MO(N)
if (nargin <100)
N = 100000;
end
T{1} = [1/3 0 0; 0 1/3 0; 0 0 1] ;
T{2} = [1/3 0 1/3; 0 1/3 0; 0 0 1] ;
T{3} = [1/3 0 2/3; 0 1/3 0; 0 0 1] ;
T{4} = [1/3 0 0; 0 1/3 1/3; 0 0 1] ;
T{5} = [1/3 0 2/3; 0 1/3 1/3; 0 0 1] ;
T{6} = [1/3 0 0; 0 1/3 2/3; 0 0 1] ;
T{7} = [1/3 0 1/3; 0 1/3 2/3; 0 0 1] ;
T{8} = [1/3 0 2/3; 0 1/3 2/3; 0 0 1] ;
X = zeros(3,N); % memory for the points
X(:,1) = [0.1; 0.1; 1]; % initial point (column 1, row x and row y)
for i = 1:N-1
Rule = floor(8*rand)+1;
X(:,i+1) = T{Rule}*X(:,i);
end
figure(1);
set(gcf, 'color', 'white'); % Sets the background Color of the plot to white
% plots all points at the end
% Pick yourt preferred Dot Color from combining (0 to 1 values)
% [ r g b ] = [red green blue];
% [0 0 0] = black,
% [1 1 1] = white,
% [1 0 0 ] = red,
% [0 1 0 ] = green,
% [0 0 1 ] = blue, etc.
% What color is [0.5 0.5 0.5 ] = ?
plot(X(1,:),X(2,:),'.','Color',[0 0 1 ],'MarkerSize',2);
axis off;
end