function [ptwt] = hermptwt(N); format long e % beta_n recurrence coefficients xn=[1:1:N]; rtb=sqrt(xn/2); rtb(N)=[]; % Jacobi matrix J=diag(rtb,-1)+diag(rtb,1); % Quadrature points are the eigenvalues % Quadrature weights from the 1st component of nth eigenvector [f,lambda]=eig(J); pt=diag(lambda); wt=sqrt(pi)*f(1,:).^2; display('Hermite quadrature points and weights') for n=1:N fprintf('%2i %26.16f %26.16e\n', n, pt(n),wt(n)); end %ptwt=[pt,wt'];