On the variation of the ambipolar diffusion coefficient with height