% Spectral Derivative for a Cheby's serie Type I function D = D_Cheb_A(n) %% Matrix of differentiation %% By the Z matrix Z = zeros(n+1,n+1); Z(2,1) = 1; Z(3,2) = 4; %% for k = 2:n-1 Z(k+2,k+1) = 2*(k+1); Z(k+2,:) = Z(k+2,:) + (k+1)*Z(k,:)/(k-1); end D = Z.';