Alright, so basically I need to make a "random walker" that walks in either direction using a for loop. It can walk forward one, back one back one forward one, it just has to be random for a thousand times. Then I need to use comet to simulate the walk, and im just not sure how to set up this code. So far I have this. I need to plot the walk as a function of time. I don't know what I'm doing wrong.
%%Part 1
% Simulation of Walker
t = linspace(0,1001,50000);x = 0;d = randn(0,2);for n = 1:1001 if d == 0 x = x; elseif d == 1 x = x + 1; else d == 2 x = x - 1; endendcomet(x,t);
Best Answer