%CHEBYREG.M %X = chebyreg(t,n) returns a t-by-n matrix. Element (i,j) of X, for i=1,...,t and j=1,...,n is given by T_j(r_i) where T_j denotes the Chebyshev polynomial of the first kind of order j and r_i denotes the i_th zero of the Chebyshev polynomial of the first kind of order t. function X = chebyreg(t,n); z = chebyzeros(t); for i=1:t X(i,1) = 1; X(i,2) = z(i); for j=3:n X(i,j) = 2*z(i)*X(i,j-1)-X(i,j-2); end end