N=10;%矩阵大小N*N
select=[5:10,inf];
a=zeros(N,N);
for i=1:N
for j=1:i;
if j==i
a(i,j)=inf;
else
rnd=rand;
if rnd>0.3
a(i,j)=inf;
a(j,i)=a(i,j);
else
b=randperm(length(select));
a(i,j)=select(b(1));
a(j,i)=a(i,j);
end
end
end
end
disp(a);
D = diag(rand(N,1))
U = orth(rand(N,N))
A = U' * D * U