• Remix
  • Share
  • New Entry

on 18 Nov 2023
  • 4
  • 2
  • 1
  • 0
  • 347
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);
plot(starX, starY, 'w*')
%plot(x(S-1:S), y(S-1:S), 'w', 'LineWidth', 2);
plot(x(S), y(S), 'r>', 'MarkerSize', 10, 'MarkerFaceColor', 'r');
axis square;
set(gca,'Color','k')
end
Animation
Remix Tree