clear; // *** 時間 *** tnum = 10000; // 時間ステップ数 t = (0:1:tnum)'; // 時間のベクトル // *** 位置の計算 *** xi = 2 * (rand(2,tnum) >= 0.5) - 1; S = [zeros(2,1), cumsum(xi,'c')]; // *** グラフのプロット *** plot(S(1,:),S(2,:),'-b'); xlabel("x position"); ylabel("y position");