function plotGaussianFit(Positions, TrappingPotential, popt, pcov)
    extracted_waist = popt(2);
    dextracted_waist = sqrt(pcov(2,2));
    gapprox = gaussian_potential(Positions, popt);
    
    figure('Position', [100, 100, 1200, 600])
    
    subplot(1,2,1)
    title('Fit to Potential')
    plot(Positions, gapprox, '-r', 'DisplayName', sprintf('waist = %.1f \\pm %.2f \\mum', extracted_waist, dextracted_waist))
    hold on
    plot(Positions, TrappingPotential, 'ob', 'DisplayName', 'Gaussian Potential')
    xlabel('Distance (\mum)', 'FontSize', 12, 'FontWeight', 'bold')
    ylabel('Trap Potential (\muK)', 'FontSize', 12, 'FontWeight', 'bold')
    ylim([min(TrappingPotential), max(TrappingPotential)])
    grid on
    legend('FontSize', 12, 'FontWeight', 'bold')

    subplot(1,2,2)
    title('Fit Residuals')
    plot(Positions, TrappingPotential - gapprox, 'ob')
    xlabel('Distance (\mum)', 'FontSize', 12, 'FontWeight', 'bold')
    ylabel('$U_{trap} - U_{Gaussian}$', 'Interpreter', 'latex', 'FontSize', 12, 'FontWeight', 'bold')
    xlim([-10, 10])
    ylim([-1, 1])
    grid on
    tight_layout()
    hold off
end

