P = legendre(n,x)
P = legendre(n,x) computes the associated Legendre functions of degree n and order m = 0,1,...,n, evaluated at x. n is an integer less than or equal to 256. x is a vector whose elements are real and have absolute value less than or equal to one. P is a matrix with n+1 rows and length(x) columns. Each element of the returned matrix, P(i,j), corresponds to the associated Legendre function of degree n and order (i-1) evaluated at x(j). The first row of P is the Legendre polynomial evaluated at x.
Note that this answer is of the formlegendre(2,0:0.1:0.2)ans =-0.5000 -0.4850 -0.44000 -0.2985 -0.58793.0000 2.9700 2.8800
P(2,0;0) P(2,0;0.1) P(2,0;0.2)P(2,1;0) P(2,1;0.1) P(2,1;0.2)P(2,2;0) P(2,2;0.1) P(2,2;0.2)
where
is the Legendre polynomial of degree n.
(c) Copyright 1994 by The MathWorks, Inc.