clear clc================== N = 10; % number of steps.
M = 10; x_t(1) = 0; for n = 1:N a = sign(randn); x_t(n+1) = x_t(n) + a; endplot(x_t);xlabel('t'), ylabel('x_t'), title('randomwalk');
Someone already helped me with this task but he rewrote the entire code as a means of vectorizing it, is there any way I could plot the same function several times while retaining the previous plot, without changing too much of my code? I'm not sure how to progress beyond this stage since it doesn't do anything when i implement
hold on
Best Answer