2.66667

2.7 | 3 ratings Rate this file 23 downloads (last 30 days) File Size: 1.99 KB File ID: #4710

Legendre polynomial Pm(x)

by Sergei Koptenko

 

02 Apr 2004 (Updated 16 Oct 2006)

Code covered by the BSD License  

Legendre polynomial Pm(x).

Download Now | Watch this File

File Information
Description

Function which constructs the Legendre polynomial Pm(x) for any M and X where M is the degree of polynomial and X is the variable or function.

MATLAB release MATLAB 6.5 (R13)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (5)
02 Nov 2005 Marc Kowalski

Does not work for MATLAB 7.x. Would have been simpler to use polyval

03 Nov 2005 Sergei Koptenko

Work of this function was checked with Matlab v. 7.0.4.365 (R14) SP2.
a) function works, however it gives a warning "Warning: Could not find an exact (case-sensitive) match for 'legendrep'... a case-insensitive match and will be used instead." After renaming mfile from 'Legendrep.m' to 'legendrep.m' warning disappeared.
b) I?m not sure, how polyval can be used instead of 'legendrep.m' to generate Legendre polynomial, so this comment is ignored

17 Nov 2006 Ondrej Machek

somethimes you have to use legendre polynomials instead of polyfit. I experienced good results using Matlab 7.0.4.

10 Sep 2008 Stig Andersson

Found a bug for m>=13.
In the loop, the variable ii should be changed to (ii+10) when it not is used as an index for pp.

        N=ii+10;
        p_ii=[num2str(1/(N)) ' * (' num2str(2*N-1) ' * ' x '.*(' ...
        deblank(pp(ii-1,:)) ')-' num2str(N-1) '*(' deblank(pp(ii-2,:)) '))'];

23 Sep 2009 Muhammad saqib

i need help on legendre polynomial function of matlab to appy on 2 dimensional matrix...can some body help..

Please login to add a comment or rating.
Updates
12 Apr 2004

rev. 1: to comply with Matlab r13 (6.5)all "break" statements were replaced by "return" statements

03 Nov 2005

Updating to Matlab R14 (SP2)-
file name changed from "Legendrep.m" to "legendrep.m"

03 Nov 2005

added example for R14

12 Oct 2006

small changes to improve Mlint score

16 Oct 2006

picture added

16 Oct 2006

a picture was added

Tag Activity for this File
Tag Applied By Date/Time
legendre polynomial Sergei Koptenko 22 Oct 2008 07:17:25
function Sergei Koptenko 22 Oct 2008 07:17:25
construct Sergei Koptenko 22 Oct 2008 07:17:25
m Sergei Koptenko 22 Oct 2008 07:17:25
x Sergei Koptenko 22 Oct 2008 07:17:25
variable Sergei Koptenko 22 Oct 2008 07:17:25
legendre polynomial Nick Scourat 13 Nov 2009 13:24:39

Contact us at files@mathworks.com