- /
-
Infinity
on 28 Oct 2024
- 10
- 98
- 0
- 0
- 392
Cite your audio source here (if applicable):
drawframe(50);
Write your drawframe function below
function drawframe(f)
close all
% Parameters for the spiral
a = 0.1; % Starting radius
b = 0.05; % Rate of increase of the radius
% Define the angular range (in radians)
theta = linspace(0, 50 * pi, f); % 4*pi for 2 full turns
% Calculate radius for each theta
r = a + b * theta;
% Convert polar to Cartesian coordinates
x = r .* cos(theta);
y = r .* sin(theta);
% Initial Plot
figure;
plot(x, y, 'LineWidth', 1, 'Color', "k");
title('Infinity')
hold on
a1 = plot(x(1), y(1), "o", 'MarkerSize', 8, 'MarkerFaceColor', 'r');
% Dynamic axis adjustment
for i = 1:length(theta)
a1.XData = x(i);
a1.YData = y(i);
% Adjust axis limits based on current point
max_radius = a + b * theta(i); % Current maximum radius
axis([-max_radius max_radius -max_radius max_radius]);
drawnow
end
end