No BSD License  

Highlights from
LegendrePoly

4.33333

4.3 | 3 ratings Rate this file 4 Downloads (last 30 days) File Size: 797 Bytes File ID: #4890
image thumbnail

LegendrePoly

by David Terr

 

07 May 2004 (Updated 15 Jun 2004)

This program returns the coefficients of the Legendre polynomial P_n, given n.

| Watch this File

File Information
Description

This program returns the coefficients of the Legendre polynomial P_n, given n. The result is a row vector with powers of x decreasing from left to right (standard MATLAB notation). Like for other polynomials, LegendrePoly(n) can be evaluated at x by typing

polyval(LegendrePoly(n),x).

Acknowledgements
This submission has inspired the following:
LegendreShiftPoly
MATLAB release MATLAB 6.0 (R12)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (4)
25 Aug 2004 Joerg Enderlein  
23 Dec 2004 anas baha

thank you very much

12 Apr 2007 Thijs Stegeman

Hi,
I find your function interesting and usefull, but I'm afraid summing the vectors produced reveals an error; while the sum of the coefficients should yield 1 (as Pn(z)=1 for every n), in fact this goes wrong (at least on my computer) at n=25 because of roudof-error (I think), to deviate to something of the order of 1.0e20 at n=99. Do you know of any kind of solution?
Other than that it works very well!
Thanks.

06 Jul 2007 Liang G

I think there is runoff error when n>39 in my computer.Can anyone fix this problem?

Please login to add a comment or rating.
Updates
18 May 2004

I replaced this with a new version which is more efficient, since it no longer stores all the previously computed Legendre polynomials.

18 May 2004

I replaced the figure with a new version with a legend and a grid.

15 Jun 2004

I modified this function so that it returns a column vector.

Tag Activity for this File
Tag Applied By Date/Time
differential equations David Terr 22 Oct 2008 07:19:20
legendre polynomial David Terr 22 Oct 2008 07:19:20
polynomial David Terr 22 Oct 2008 07:19:20
mathematics David Terr 22 Oct 2008 07:19:20
differential David Terr 22 Oct 2008 07:19:20

Contact us at files@mathworks.com