The problem I have with my code is that it keeps assign the X and Y values to zeros and doesn't plot the 10000 values of X and Y. Here is the code:
R = randi([1,4],10000,1); for i=1 X(i)=0; y(i)=0; endfor i=1:10000;if R == 1 X(i) = X(i)+1; elseif R == 2 X(i) = X(i)-1; elseif R == 3 y(i) = y(i)+1; elseif R == 4 y(i) = y(i)-1; endendplot(X,y);comet(X,y)grid on;
Best Answer