Engineering Math - Quick Reference                                 Home : www.sharetechnote.com

 

 

 

Chaos - Sierpinski triangle

 

Description/Explanation will come later.

 

 

    v = [0,0;0.5,0.7;1,0];

    Nv = 20000;

    x1 = 0.0;

    y1 = 0.5;

     

    vList = [x1,y1];

     

    for i = 1:Nv

        vidx = randi([1 3]);

        vsel = v(vidx,:);

        x2 = vsel(1);

        y2 = vsel(2);

        x = (x2+x1)/2.0;

        y = (y2+y1)/2.0;

        vList = [vList;x y];

        x1 = x;

        y1 = y;

    end;

     

    plot(vList(:,1),vList(:,2),'bo','MarkerSize',1);