- /
- 
        MATLAB Mind control
        on 15 Nov 2023
        
        
 
    - 18
- 66
- 2
- 0
- 277
drawframe(1);
Remix ideas
- Change the circles to squares or another shape
- Do something more interesting with color
- Reverse the direction of movement
Write your drawframe function below
function drawframe(f)
    set(gca,'Position',[0 0 1 1])   % Enlarge axes
    set(gcf,'Color','k')            % Set fig color to black
    r = f + -45:10:200;             % Radii of circles
    r(r<2) = 2;                     % Remove small and negative radii
    th = linspace(0,2*pi,300).';    
    x = r.*cos(th);                 % x values of all circles
    y = r.*sin(th);                 % y values of all circles
    colors = cool(numel(r));        % RGB color matrix
    h = plot(x,y,'LineWidth',3);    % Plot circles 
    axis equal
    for i = 1:numel(h)  
        h(i).Color = colors(i,:);   % Assign color to each line
    end
    xlim([-100 100])                
    ylim([-100 100])
    axis off
end
Animation
 
           

 

 
             
             
               
 
              