The aim of this work is to propose a methodology for computing the current
distribution able to produce a known magnetic field in a specified domain i
n the 3D free space. By combination of the Biot-Savart law and the superpos
ition theorem, an algebraic relationship between the predefined magnetic fi
eld and the searched current density has been established. So, this inverse
problem formulation provides the magnet modeling through its equivalent cu
rrent density. The discrete approach consists in modeling this current dens
ity by a list of values corresponding to a mesh of the magnet support surfa
ce. Furthermore, the use of the spherical harmonic expansion of the predefi
ned magnetic field leads to a compact formulation of the inverse problem. T
he proposed matrix methodology has been developed on any magnet having a re
volution axis (conical magnets). The matrix shape of this general methodolo
gy permits to formulate and to solve the inverse problem with optimal crite
ria. A computer code, which uses both approaches, has been developed and ap
plied to Magnetic Resonance imaging (MRI) magnet design. This code leads to
good simulation results, showing great opportunities to new magnet design.