Magnetic-field distortions by objects placed in a uniform and static field: Numerical simulations and experiments with nuclear magnetic resonance