The scope of this paper is to demonstrate a least square method for optimisation of basic parameters for selected physical experiment design where large input parameter measurement and adjustment is needed. The speed of calculation and experimentally verified results are promising to use this method in many physical projects. We have demonstrated this method for computation of feeding currents of correcting coils for stationary magnetic field used in NMR imaging. A set of linear equation definition and determination of a target function and optimisation computations are presented with procedures that provide optimal values of currents for shim coils. The proposed method, because of its simplicity and speed of computation, is convenient for basic adjustment of the magnetic field homogeneity by the first magnet installation. It is also suitable for periodic testing and magnet inhomogeneity correction for MRI magnets.