function P = polyfit(Lx,Ly,d) 
    Lx = Lx(:); Ly = Ly(:);    
    M  = (Lx*ones(1,d+1)).^(ones(Lx)*(0:d));
    M   = M(:,$:-1:1); P = M\Ly; P  = conj(P)'; 
endfunction
