61 lines
2.1 KiB
Matlab
61 lines
2.1 KiB
Matlab
function [] = print_figure_pdf(data,params,type)
|
|
%PRINT_FIGURE_PDF creates pdf figures of TREPR data
|
|
%
|
|
% Usage: PRINT_FIGURE_PDF(data,params,type), where data are TREPR data
|
|
% loaded by LOAD_MATLAB or LOAD_BRUKER, params is a struct created by
|
|
% SIMULATION_TREPR and type a number.
|
|
%
|
|
% type = 1: 2D plot of data and simulation with magnetic field as x-axis
|
|
% type = 2: 3D plot of data without simulation
|
|
|
|
if type == 1
|
|
%getting simulation values
|
|
Exp.mwFreq = params.mwFreq; % GHz
|
|
Exp.nPoints = length(params.Field_Vector);
|
|
Exp.CenterSweep = 0.1*[params.Field_Center params.Field_Sweep]; % mT (converted from Gauss)
|
|
Exp.Harmonic = 0; % zeroth harmonic
|
|
Exp.Temperature = params.Triplett_pop;
|
|
Sys = params.Fitted_Simulation;
|
|
%calculate simulation
|
|
[~,spec] = pepper(Sys,Exp);
|
|
spec_norm = spec/max(spec); % normalize the simulation
|
|
%plot invisible and print
|
|
figure('Visible','off')
|
|
plot(0.1*params.Field_Vector,params.max_mean,'r',...
|
|
0.1*params.Field_Vector,spec_norm,'b','LineWidth',1.2)
|
|
xlabel 'Magnetic Field / mT'
|
|
ylabel 'EPR signal / A. U.'
|
|
legend('experimental','simulation')
|
|
title(params.Name, 'Interpreter','none')
|
|
axis tight
|
|
set(gcf,'Units','Inches');
|
|
pos = get(gcf,'Position');
|
|
set(gcf,'PaperPositionMode','Auto','PaperUnits','Inches','PaperSize',[pos(3), pos(4)]);
|
|
figurepath = strcat(params.Path,"/",params.Name,"_Sim.pdf"); %create full filename
|
|
print(gcf,figurepath,'-dpdf','-r0');
|
|
|
|
elseif type == 2
|
|
%plot invisible and print
|
|
figure('Visible','off')
|
|
surf(0.1*params.Field_Vector, params.TimeBase*1e6, data)
|
|
colormap default
|
|
shading interp
|
|
view(305,10)
|
|
axis tight
|
|
xlabel 'Magnetic Field / mT'
|
|
ylabel 'Time / \mus'
|
|
zlabel 'EPR Signal / A.U.'
|
|
title(params.Name, 'Interpreter','none')
|
|
set(gcf,'Units','Inches');
|
|
pos = get(gcf,'Position');
|
|
set(gcf,'PaperPositionMode','Auto','PaperUnits','Inches','PaperSize',[pos(3), pos(4)]);
|
|
figurepath = strcat(params.Path,"/",params.Name,"_3D.pdf"); %create full filename
|
|
print(gcf,figurepath,'-dpdf','-r0');
|
|
|
|
else
|
|
error('Unknown plot type.');
|
|
end
|
|
|
|
end
|
|
|