function B=MatrixB(n) %Function B=temp1(n) outputs an nxn matrix B with ones along the diagonal, %-1's above the diagonal, and zeros below the diagonal. B=eye(n); for j=1:n for k=j+1:n B(j,k)=-1; end end