I'm using a for-loop in order to plot the 'track' from a particle that moves in a specific way. When I try to plot lines inside the for-loop I only get dots.
This is my code:
a = [0];
b = [0];
for k = 1:10
r = randn(1,2);
a = a+r(1);
b = b+r(2);
k = k+1;
plot(a,b,'-r')
pause(1)
end
I've read other questions about this here at stackoverflow but those answers doesn't work for me.