% general parameters
tEnd = 12000;
t = linspace(0, tEnd, 5000);
T1 = 2000; %ms
%% Longitudinal Magnetization
figure('Position', [100 100 1200 500])
hold on
axT1 = gca;
axT1.TickLabelInterpreter = 'latex';
set(axT1, 'Position', [0.2 0.1 0.7 0.8])
plot([0 tEnd], [1 1], 'k--', ...
'LineWidth', 2, ...
'color', 0.4*[1 1 1])
plot(t, 1-exp(-t/T1), ...
'LineWidth', 2);
plot([T1 T1], [0 1-exp(-1)], 'k--', ...
'LineWidth', 1, ...
'color', 0.4*[1 1 1])
plot([0 T1], [1-exp(-1) 1-exp(-1)], 'k--', ...
'LineWidth', 1, ...
'color', 0.4*[1 1 1])
ylim([0 1.1])
xlim([0 1.025*tEnd])
xticks([T1 1.025*tEnd])
xticklabels({'$T_1$', 't'})
yticks([0 1-exp(-1) 1])
yticklabels({'$0$', '$M_{z, \mathrm{eq}}(1-1/\mathrm e)$', '$M_{z, \mathrm{eq}}$'})
set(gca,'TickLength',[0, 0])
set(gca,'LineWidth', 1)
title('relaxation of longitudinal magnetization')
axT1.FontSize = 20;
saveas(gcf, 'relaxation longitudinal magnetization.svg')