2016-11-13 5 views
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は機能しません。

答えて

0

あなたはspy()機能を探しています。 spy(m)と入力して、何が起こるかを確認してください。

+0

が正しく動作していますが、私は異なる数字を持っていると仮定し、それぞれの数字の集合を指定された色でプロットしたいとします。 –

+0

@ MP.Chalあなたは本当にイメージを探しているよりも。 'imagesc()'を見てみましょう。 –

関連する問題