- /
 - 
        
Geometric demonstration of geometric series
 
        on 30 Nov 2023
        
        
 
    - 6
 - 28
 - 0
 - 1
 - 584
 
drawframe(48);
 Write your drawframe function below
function drawframe(f)
    x1 = [0 1 1 0];
    y1 = [1 1 2 2];
    x2 = [1 2 2 1];
    y2 = y1;
    x3 = x2;
    y3 = [0 0 1 1];
    for i=0:floor(f/8)
        s = 2^-i;
        if i==0
            t = '1/4';
        else
            t = ['1/4^' num2str(i+1)];
        end
        patch(x1*s,y1*s,'b','edgecolor','k'); text(0.5*s,1.5*s,t,'horizontalalignment','center','VerticalAlignment','middle','fontsize',25/1.5^(i+1));
        patch(x2*s,y2*s,'r','edgecolor','k'); text(1.5*s,1.5*s,t,'horizontalalignment','center','VerticalAlignment','middle','fontsize',25/1.5^(i+1));
        patch(x3*s,y3*s,'y','edgecolor','k'); text(1.5*s,0.5*s,t,'horizontalalignment','center','VerticalAlignment','middle','fontsize',25/1.5^(i+1));
        axis equal off;
    end
end
Animation
           

