Plot a matrix in graph with two axis in matlab -
i need plot nxn matrix 'm' full of zeros, show cases m(x,y) different 0.
t_max = 10; % set maximum number of iterations n = 10; % dimension n*n d = 1; % probability of changing place x = randi([1 n]); % random row y = randi([1 n]); % random column grid = zeros(10); % set empty gride n*n grid(x,y) = 1; % put agent in random place t=1:t_max newgrid = randomwalk1(grid,d); % call function random walk 1 agent end
i tried image(m)
it's not giving satisfying results since need keep track of element different 0, hold on
doesn't work in case.
you looking spy()
function. type spy(m)
, see happens.
Comments
Post a Comment