function P = polinomiolegendre(n)
 if(n==0)
  P = 1;
 elseif (n==1)
  P = [1 0];
 else
  aux1 = (2*n-1)*conv([1 0],polinomiolegendre(n-1));
  aux2 = polinomiolegendre(n-2);
  P = (aux1-(n-1)*[zeros(1,length(aux1)-length(aux2)) aux2])/n;
 endif
endfunction
