Gaussian Quadrature ( Legendre Polynomials )
Ältere Kommentare anzeigen
I have tried to create a function that will find the coefficients of the nth order Legendre polynomial without using syms x, but I have got stuck on how to actually get the coefficients with 2 unknowns in my equation... Can anyone help a bit??
Here's my code :
function [y] = LegendrePoly(n)
if n == 0
y = 1;
elseif n == 1
y = x;
else
x = zeros(n+1,1);
x(n+1) = 1;
x_1 = zeros(n+1,1);
x_1(n) = 1;
for i=2:n;
y(i)=((2*x_1(n))/x_1(n))*x*y(i-1)-(x(n-1)/x_1(n))*y(i-2);
end
end
1 Kommentar
Karan Gill
am 13 Nov. 2017
There's an example on this topic: https://www.mathworks.com/help/symbolic/examples/gauss-laguerre-quadrature-evaluation-points-and-weights.html. Is it helpful?
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Polynomials finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!