function ds=chdx(s); % The function ds=ledx(s) computes the first derivative of truncated Chebyshev series expansion. % Input: % s--Chebyshev coefficients % output: % ds--Chebyshev coefficients of 1st-order derivative nn=length(s); n=nn-1; ds=[]; ds(nn)=0;ds(nn-1)=2*n*s(nn); for k=n-1:-1:1, ds(k)=ds(k+2)+2*k*s(k+1); end; ds(1)=ds(1)*.5d0; ds=ds'; if size(s,1)