% @(#) 6.728 Utility code -- Matlab Code % @(#) Computes the 1 through nth Hermite polynomials and stores them % @(#) in a matrix. This code uses looping convolutions - speed is good. function s = hermall(hsize); hm=zeros(hsize+1,hsize+1); hp2 =[1]; hm(1,:) = [ zeros(1,hsize) 1]; hp1 =[2 0]; hm(2,:) = [ zeros(1,hsize-1) 2 0]; for n=2:(hsize); h=conv([2 0],hp1)-[0 0 2*(n-1)*hp2]; hp2 = hp1; hp1 = h; hm(n+1,:) = [ zeros(1,hsize-n) h] ; end clear hp1 clear hp2 clear h s=sparse(hm); clear hm