

L k + 1 ( x) 2 k 1 k x L k ( x) k 1 k L k 1 ( x) I want to calculate the value of L k ( x) for any given value x. Uses only standard matlab features, should work with any version of matlab tested on 2008b, 2009b, 2010a. The legendre polynomials are recursively defined as follows. There is no additional scaling is done (e.g., Schmidt), but these should not affect significantly the run time. For |x|>1, returns NaN rather than error comment this line if you don't need this check. All I need is is the simple Legendre polynomial of degrees 0-299, which corresponds to the first element in the array that this function returns. Even calculating all 9 orders takes only about 1.5 sec.Īssociated Legendre polynomials are defined for 0l, rather than returning an error. I see in MATLAB that you can call legendre(n,X) and it returns the associated legendre polynomials. This function is much faster than the built in, especially for larger degrees for 100^3 array, the built-in legendre(8,x) takes about 9.5 sec, while legendreP(8,6,x) takes only 0.15sec. (AI) are known as the Legendre polynomials. We may also set cos B, where B is a real number. LEGENDRE POLYNOMIALS Let x be a real variable such that -1 x 1. Some of the orders were checked for all degrees up to l=20 as well. LEGENDRE POLYNOMIALS, ASSOCIATED LEGENDRE FUNCTIONS AND SPHERICAL HARMONICS AI. The numerical returns were checked for every order for all degrees up to m using an array of size 128^1, filled with random numbers between -1 and 1 the difference compared with the built-in were within numerical errors (relative error ~1e-15).

A second optional output estimates the error, based on the largest polynomial coefficient. On the contrary, MATLABs roots function uses a general form for the companion. For these cases, it is better to use recursive formulas. Provider for Gauss-Legendre integration nodes with variable count. The polynomial coefficients can be very large for moderate/high degrees, leading to reduced precision. The polynomial is computed using exactly l/2 multiplications and additions for any structure of the data array x. The coefficients are computed recursively from earlier coefficients (to avoid computing multiple factorials). The polynomial coefficients are calculated analytically. If the signal is multifractal, (q) is a non-linear function (Lin and Hughson, 2001).Note that different authors use different notations. In the case of monofractals the exponent function grows linearly, (q) q(1). The function legendreP(l,m,x) is a drop-in substitute for legendre(l,x), except that it only calculates the required order. the scaling exponent is a function, (q), which defines the fractal properties of the signal under study. If you only need a given order, this is a waste of memory and computing time (especially for large blocks of data). The built-in legendre() calculates the Legendre polynomials calculated ALL the orders for a given degree.
