function y=numleg(l,m,x)
% function y=numleg(l,m,x)
% Calculates the associated Legendre function
%
%        P_{l}^{m}(x)
%
if l==0
y=1;
else
A = legendre(l,x);
y = (-1)^m*squeeze(A(m+1,:,:,:));
end
