from
ChebyshevTools
by Michael Watson Tool box for solving ODE/PDEs using spectral Chebyshev differentiation matrices.
B=pseudo_eye(M,P)
function B=pseudo_eye(M,P)
%this function returns the pseudo-identity matrix I^(P), where there are
%ones on the main diagonal, except the top P entries which are zero
B=eye(M);
if P>0
B(1:P,:)=0;
else
B(end-P+1:end,:)=0;
end
B=sparse(B);