Vectorization the Legendre Polynomial Without loop
Afficher commentaires plus anciens
Hi All,
I would like to speed up this Legendre polynomial code without using loop. It has a significant delay in my associated code
I would like to alwasy keep L as option which can be changed
t=[1/60:1/60:3];
L=221;
P=zeros(L+1,length(t));
P(1,1:length(t)) = 1;
P(2,1:length(t)) = t;
for i = 2:L
P(i+1,:) = -(i-1)./i.*P(i-1)+(2.*i-1)./i.*t.*P(i);
end
The equation for the Legendre polynomial is
where
and 
PS: I corected the mathematical equation, sorry for the inconvenience
Many thanks in advance
Réponse acceptée
Plus de réponses (1)
Ahmed
le 16 Fév 2019
0 votes
Catégories
En savoir plus sur Polynomials dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!