Magnetoencephalography (MEG) and magnetic resonance imaging (MRI) are non-invasive imaging techniques that offer effective means for disease diagnosis. A more straightforward and optimized method is presented for designing gradient coils which are pivotal parts of the above imaging systems.