from
ChebyshevTools
by Michael Watson Tool box for solving ODE/PDEs using spectral Chebyshev differentiation matrices.
D=deriv(M);
function D=deriv(M);
%returns the first order chebyshev spectral differentiation matrix
D=zeros(M);
for i=0:M-2
for j = i+1:2:M-1
D(i+1,j+1)=(2/myC(i))*(j);
end
end