I = eye(n);J = I(:, [2:n,1]);A = J + J' + J^2 + J'^2;% 如果要随机一点的可以再加上下面两行ind = randperm(n);A = A(ind, ind)