0
内の2つの軸を持つグラフの行列「M」ゼロの完全なだけM(x、y)が0プロットIは、N×Nの行列をプロットする必要がMATLAB
t_max = 10; % set the maximum number of iterations
n = 10; % dimension n*n
d = 1; % the probability of changing place
x = randi([1 n]); % random row
y = randi([1 n]); % random column
grid = zeros(10); % set an empty gride n*n
grid(x,y) = 1; % put an agent in a random place
for t=1:t_max
newgrid = randomwalk1(grid,d); % call the function random walk for one agent
end
異なる場合を示し
私はimage(m)
を試しましたが、0とは異なる要素を追跡する必要があるため、満足な結果を得られていません。この場合、hold on
は機能しません。
が正しく動作していますが、私は異なる数字を持っていると仮定し、それぞれの数字の集合を指定された色でプロットしたいとします。 –
@ MP.Chalあなたは本当にイメージを探しているよりも。 'imagesc()'を見てみましょう。 –