function plotPotential(Positions, ComputedPotentials, options, Params, ListToIterateOver, saveFlag) axis = options.Axis; figure('Position', [100, 100, 900, 700]) for i = 1:size(ComputedPotentials, 2) IdealTrapDepthInKelvin = Params{1}{1}(1); EffectiveTrapDepthInKelvin = Params{1}{1}(2); idealv = Params{1}{2}{1}(1); idealdv = Params{1}{2}{1}(2); if options.ExtractTrapFrequencies v = Params{1}{2}{2}(1); dv = Params{1}{2}{2}(2); else v = NaN; dv = NaN; end if ~isempty(ListToIterateOver) if size(ComputedPotentials, 1) == length(ListToIterateOver) plot(Positions(axis, :), ComputedPotentials{i}(axis, :), 'DisplayName', ... ['Trap Depth = ' num2str(round(EffectiveTrapDepthInKelvin, 2)) ' \muK; ' Helpers.generatePlotLabel(v, dv)]) else if mod(i, 2) == 0 plot(Positions(axis, :), ComputedPotentials{i}(axis, :), '--', 'DisplayName', ... ['Trap Depth = ' num2str(round(IdealTrapDepthInKelvin, 2)) ' \muK; ' Helpers.generatePlotLabel(idealv, idealdv)]) else plot(Positions(axis, :), ComputedPotentials{i}(axis, :), 'DisplayName', ... ['Effective Trap Depth = ' num2str(round(EffectiveTrapDepthInKelvin, 2)) ' \muK; ' Helpers.generatePlotLabel(v, dv)]) end end else if mod(i, 2) == 0 plot(Positions(axis, :), ComputedPotentials{i}(axis, :), '--', 'DisplayName', ... ['Trap Depth = ' num2str(round(IdealTrapDepthInKelvin, 2)) ' \muK; ' Helpers.generatePlotLabel(idealv, idealdv)]) else plot(Positions(axis, :), ComputedPotentials{i}(axis, :), 'DisplayName', ... ['Effective Trap Depth = ' num2str(round(EffectiveTrapDepthInKelvin, 2)) ' \muK; ' Helpers.generatePlotLabel(v, dv)]) end end hold on; end switch axis case 1 dir = 'X - Horizontal'; case 2 dir = 'Y - Propagation'; case 3 dir = 'Z - Vertical'; end ylim([min(min(ComputedPotentials{i}(axis, :))), 0]); xlabel([dir ' Direction (\mum)'], 'FontSize', 12, 'FontWeight', 'bold') ylabel('Trap Potential (\muK)', 'FontSize', 12, 'FontWeight', 'bold') grid on legend('Location', 'southeast', 'FontSize', 12, 'FontWeight', 'bold') if saveFlag saveas(gcf, ['pot_' dir '.png']) end hold off end