An analytical method that was developed formerly for the reconstruction of velocity profiles in asymmetric flows is improved to be applicable for both axisymmetric and asymmetric flows. The method is implemented in Matlab, and predicts the velocity profile from measured electrical potential distributions obtained around the boundary of a multi-electrode electromagnetic flow meter (EMFM). Potential distributions are measured in uniform and nonuniform magnetic fields, and the velocity is assumed as a sum of axisymmetric and polynomial components. The procedure requires three steps. First, the discrete Fourier transform (DFT) is applied to the potential distribution obtained in a uniform magnetic field. Since the direction of polynomial components of order greater than two in the plane of the pipe cross section is not unique multiple solutions exist, therefore all possible polynomial velocity profiles are determined. Then, the DFT is applied to the potential distribution obtained in a specific nonuniform magnetic field, and used to calculate the exponent in a power-law representation of the axisymmetric component. Finally, the potential distribution in the non-uniform magnetic field is calculated for all of the possible velocity profile solutions using weight values, and the velocity profile with the calculated potential distribution which is closest to the measured one provides the optimum solution. The method is validated by reconstructing two quartic velocity profiles, one of which includes an axisymmetric component. The potential distributions are obtained from simulations using COMSOL Multiphysics where a model of the EMFM is constructed. The reconstructed velocity profiles show satisfactory agreement with the input velocity profiles. The main benefits of the method described in this paper are that it provides a velocity distribution in the circular cross section of a pipe as an analytical function of the spatial coordinates which is suitable for both axisymmetric and asymmetric flows.