core/matlab/examples/mex/gasket.m

00001 function theImage = gasket(numPoints)
00002 %GASKET An image of a Sierpinski Gasket.
00003 %   IM = GASKET(NUMPOINTS)
00004 %
00005 %   Example:
00006 %   x = gasket(50000);
00007 %   imagesc(x);colormap([1 1 1;0 0 0]);
00008 %   axis equal tight
00009 
00010 %   Copyright 1984-2003 The MathWorks, Inc.
00011 %   $ Revision: 1.1 $  $Date: 2007/12/11 19:59:58 $
00012 
00013 theImage = zeros(1000,1000);
00014 
00015 corners = ;
00016 startPoint = ;
00017 theRand = rand(numPoints,1);
00018 theRand = ceil(theRand*3);
00019 
00020 for i=1:numPoints
00021    startPoint = floor((corners(theRand(i),:)+startPoint)/2);
00022    theImage(startPoint(1),startPoint(2)) = 1;
00023 end

GridLAB-DTM Version 1.0
An open-source project initiated by the US Department of Energy