function visualizeMagneticField(obj, x_range, y_range, z_range)
    
    f_h = Helper.getFigureByTag('VisualizeMagneticFieldFor2DMOT');
    set(groot,'CurrentFigure',f_h);
    a_h = get(f_h, 'CurrentAxes');
    if ~isempty(get(a_h, 'Children')) 
        clf(f_h);
    end
    f_h.Name  = 'Visualization';
    f_h.Units = 'pixels';
    
    set(0,'units','pixels');
    screensize = get(0,'ScreenSize');
    f_h.Position = [[screensize(3)/3.5 screensize(4)/3.5] 820 645];

    xmin = x_range(1);
    xmax = x_range(2);
    ymin = y_range(1);
    ymax = y_range(2);
    zmin = z_range(1);
    zmax = z_range(2);
    dx = (xmax-xmin)/8;
    dy = (ymax-ymin)/8;
    dz = (zmax-zmin)/8;
    if dx ~= 0
        xm = xmin:dx:xmax;
    else
        xm = zeros(1,5);
    end

    if dy ~= 0
        ym = ymin:dy:ymax;
    else
        ym = zeros(1,5);
    end

    if dz ~= 0
        zm = zmin:dz:zmax;
    else
        zm = zeros(1,5);
    end
    [meshx,meshy,meshz] = meshgrid(xm,ym,zm);  % construct data points

    switch obj.SimulationMode
        case '2D'
            alpha      = obj.MagneticGradient;
            Bx = @(x,y,z) alpha .* z;
            By = @(x,y,z)     0 .* y;
            Bz = @(x,y,z) alpha .* x;
            Bx_val = Bx(meshx, meshy, meshz);
            By_val = By(meshx, meshy, meshz);
            Bz_val = Bz(meshx, meshy, meshz);
        case '3D'
            % Development in progress
    end

    quiver3(meshx, meshy, meshz, Bx_val, By_val, Bz_val, 'Color', ' #6600ff');
    axis equal
    
    hXLabel = xlabel('x');
    hYLabel = ylabel('y');
    hZLabel = zlabel('z');
    
    hTitle  = sgtitle('Magnetic Field for 2-D MOT');
    
    set([hXLabel, hYLabel, hZLabel]  , ...
        'FontSize'   , 14          );
    set( hTitle                    , ...
        'FontSize'   , 18          );
    
    Helper.bringFiguresWithTagInForeground();
end