%% Federico Lombardi
%% 18/07/2019
%% Simulations of DFB1 in DCM RT

clear
%% Import data from files
filename = '003_DFB1_RT_DCM_0.5mM_baseline.DTA';
[B,spc,params] = eprload(filename);
spc = real(spc);
spc = spc/max(spc);

%% Scale frequency according to g factor correction and to the solid sample
B = B/2.0022*2.000525;
freq_solid = 9.407688;

%% Define system
Exp.mwFreq = 9.396281;                      
Exp.Range = [330 (330 + 10)];                  
Exp.nPoints = 2000;

DFB1.S = 1;
DFB1.g = 2.0025;
DFB1.lw = 0.57;
[Field, Spec] = pepper(DFB1,Exp);
Spec = Spec/max(Spec);
Field = Field';
Spec = Spec';
B = B*freq_solid/Exp.mwFreq;
Field = Field*freq_solid/Exp.mwFreq;

%% Plot
figure
plot(B,spc,Field*10,(Spec))
