Description: |
Fractional differentiation and integration. The n-th order derivative or integral of a function is calculated through Fourier series expansion. The coefficients of the Fourier series are extracted, including a0, for a function defined in a given range [#a# #b#]. The necessary integrations are performed with the Gauss-Legendre quadrature rule. Selection for the number of desired Fourier coefficient pairs is made as well as for the number of the Gauss-Legendre integration points. Unlike many publicly available functions, this function can work for #numGauss#>=46. It does not rely on the build-in Matlab routine ’roots’ to determine the roots of the Legendre polynomial, but finds the roots by looking for the eigenvalues of an alternative version of the companion matrix of the n’th degree Legendre polynomial. The companion matrix is constructed as a symmetrical matrix, guaranteeing that all the eigenvalues (roots) will be real. On the contrary, the ’roots’ function uses a general form for the companion matrix, which becomes unstable at higher values of #numGauss#, leading to complex roots. |