Gaussian Quadrature ( Legendre Polynomials )
Show older comments
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 Comment
Karan Gill
on 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?
Accepted Answer
More Answers (0)
Categories
Find more on Polynomials in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!