A magnetically operated machine, comprising: a central magnet, which is configured to traverse a path having first and second ends, said ends being bounded by stops, and is connected by a linkage to rotate a shaft as the central magnet traverses the path; first and second side magnets (32, 34), which are respectively disposed adjacent to the first and second ends of the path and are oriented to repel the central magnet, so that a magnetic force between the central magnet and the first and second side magnets causes the central magnet to oscillate between the first and second ends of the path, thereby rotating the shaft; and first and second shutter assemblies, respectively disposed between the first and second side magnets and the first and second ends of the path, the first and second shutter assemblies being operative to move toward the central magnet as the central magnet approaches the shutter assembly, and to move back, as the central magnet moves away toward the opposite end of its path, each of said first and second shutter assemblies comprising: at least one ferromagnetic shutter, having open and closed positions; and a mechanism, which is arranged to open the at least one ferromagnetic shutter as the central magnet approaches the shutter assembly, and to close it, as the central magnet moves away toward the opposite end of its path, thereby modulating the magnetic force synchronously with oscillation of the central magnet. a central magnet, which is configured to traverse a path having first and second ends, said ends being bounded by stops, and is connected by a linkage to rotate a shaft as the central magnet traverses the path; first and second side magnets (32, 34), which are respectively disposed adjacent to the first and second ends of the path and are oriented to repel the central magnet, so that a magnetic force between the central magnet and the first and second side magnets causes the central magnet to oscillate between the first and second ends of the path, thereby rotating the shaft; and first and second shutter assemblies, respectively disposed between the first and second side magnets and the first and second ends of the path, the first and second shutter assemblies being operative to move toward the central magnet as the central magnet approaches the shutter assembly, and to move back, as the central magnet moves away toward the opposite end of its path, each of said first and second shutter assemblies comprising: at least one ferromagnetic shutter, having open and closed positions; and a mechanism, which is arranged to open the at least one ferromagnetic shutter as the central magnet approaches the shutter assembly, and to close it, as the central magnet moves away toward the opposite end of its path, thereby modulating the magnetic force synchronously with oscillation of the central magnet. at least one ferromagnetic shutter, having open and closed positions; and a mechanism, which is arranged to open the at least one ferromagnetic shutter as the central magnet approaches the shutter assembly, and to close it, as the central magnet moves away toward the opposite end of its path, thereby modulating the magnetic force synchronously with oscillation of the central magnet.