leg_dke_yp

PURPOSE ^

SYNOPSIS ^

function [Pn,cL] = leg_dke_yp(x,m)

DESCRIPTION ^

    Fast calculation of the Legendre polynomial Pn(x) of degree m

    Input:
    
        - x: x-vector between [-1,1] [1,n]
        - m: degree of the Legendre polynomial [1,1]
          (default = 0)

    Output:

        - Pn: Legendre polynomials up to degree m [m+1,n]
       - cL: Legendre coefficient up to degree m [m+1] 

    Warning: Pn(k+1,:) is corresponding to the Legendre polynomial of    degree k.

 by Joan Decker <jodecker@mit.edu> (MIT/RLE) and Yves Peysson <yves.peysson@cea.fr> (CEA/DRFC)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [Pn,cL] = leg_dke_yp(x,m)
0002 %
0003 %    Fast calculation of the Legendre polynomial Pn(x) of degree m
0004 %
0005 %    Input:
0006 %
0007 %        - x: x-vector between [-1,1] [1,n]
0008 %        - m: degree of the Legendre polynomial [1,1]
0009 %          (default = 0)
0010 %
0011 %    Output:
0012 %
0013 %        - Pn: Legendre polynomials up to degree m [m+1,n]
0014 %       - cL: Legendre coefficient up to degree m [m+1]
0015 %
0016 %    Warning: Pn(k+1,:) is corresponding to the Legendre polynomial of    degree k.
0017 %
0018 % by Joan Decker <jodecker@mit.edu> (MIT/RLE) and Yves Peysson <yves.peysson@cea.fr> (CEA/DRFC)
0019 %
0020 if nargin < 1,
0021     infoyp(2,'Wrong number of input arguments for leg_dke_yp');
0022     return;
0023 end
0024 if nargin == 1,
0025     m = 0;
0026 end
0027 %
0028 sx = size(x);
0029 Pn = ones(m+1,sx(2));
0030 Pn(2,:) = x;
0031 %
0032 for i=2:m,
0033      Pn(i+1,:) = ((2*i-1)*x.*Pn(i,:)-(i-1)*Pn(i-1,:))/i;
0034 end
0035 %
0036 cL=([1:m+1]'-1/2);

Community support and wiki are available on Redmine. Last update: 18-Apr-2019.