External magnetic fields can be generated using permanent magnets or electromagnets. Permanent magnets create a consistent magnetic field, while electromagnets allow for the field to be controlled and varied by adjusting the electric current. At the nanoscale, specialized equipment and techniques, such as magneto-optical traps and magnetic tweezers, are often used to generate and manipulate these fields.