function [ptwt]=lagptwt2(N,alf); format long e % Recurrence coefficients alpha_n and beta_n xn=[0:1:N-1]; a=2*xn+alf+1; rtb=sqrt(xn.*(xn+alf)); rtb(1)=[]; % Jacobi matrix J=diag(rtb,-1)+diag(a)+diag(rtb,1); % quadrature points as the eigenvalues. % quadrature weights from the 1st component of the ith eigenvector [f,lambda]=eig(J); pt=diag(lambda); wt=gamma(alf+1)*f(1,:).^2; display('Laguerre quadrature points and weights') for n=1:N fprintf('%2i %26.16f %26.16e\n', n, pt(n),wt(n)) end %ptwt=[pt,wt'];