I have so far only been able to make a 1D randomwalk but I have to make it into 2D. Below is my code for 1D. How do I change it so that it is in 2D?
clear clc N = 100; % Length of the x-axis, also known as the length of the random walks.
M = 400; % The amount of random walks.
x_t(1) = 0; for m=1:M for n = 1:N % Looping all values of N into x_t(n).
A = sign(randn); % Generates either +1/-1 depending on the SIGN of RAND.
x_t(n+1) = x_t(n) + A; end plot(x_t); hold on end
Best Answer