% % This is gl.m % weights and nodes for Gauss-Legendre integration % ex =input(' number of nodes, 2, 4, 6 or 8 ? ') if ex==2 W=[1.0 1.0]; X=[-.5773502692 .57735026992]; elseif ex==4 W=[.3478546451 .6521451549 .652145149 .3478546451]; X=[-.8611363116 -.3399810436 .3399810436 .8611363116]; elseif ex==6 W=[.1713244924 .360761573 .4679139346 .4679139346 .360761573 .1713244924]; X=[-.9324695142 -.6612093865 -.2386191861 .2386191861 .6612093865 ... .9324695142]; elseif ex==8 W=[.1012285363 .2223810345 .3137066459 .3626837834 .3626837834 ... .3137066459 .2223810345 .1012285363]; X=[-.9602898565 -.7966664774 -.5255324099 -.1834346425 .1834346425 ... .5255324099 .7966664774 .9602898565]; else disp ('no data for this n') end