• Remix
  • Share
  • New Entry

on 18 Nov 2023
  • 6
  • 10
  • 0
  • 0
  • 500
drawframe(1);
Write your drawframe function below
function drawframe(S)
x = zeros(1, S);
y = zeros(1, S);
for i = 2:S
x(i) = x(i-1) + randn();
y(i) = y(i-1) + randn();
end
figure('Color', 'k');
hold on;
Stars = 100;
rng(1,'twister');
starX = rand(1, Stars) * range(x) + min(x);
starY = rand(1, Stars) * range(y) + min(y);
starSizes = randi([1, 3], 1, Stars);
starColors = rand(Stars, 3);
for i = 1:Stars
plot(starX(i), starY(i), 'wo', 'MarkerSize', starSizes(i), 'MarkerFaceColor', starColors(i, :));
end
plot(x(S), y(S), 'r>', 'MarkerSize', 10, 'MarkerFaceColor', 'r');
axis square;
set(gca, 'Color', 'k');
end
Animation
Remix Tree
Load full remix tree