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

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

%% Scale frequency according to g factor correction
B = B/2.0022*2.000525;


%% Define system
Exp.mwFreq = 9.407688;                      
Exp.Range = [332.9 (332.9 + 6)];                  
Exp.nPoints = 1200;

DFB1.S = 1;
DFB1.g = 2.0025;
DFB1.lw = [0.365 0.75];
fL = DFB1.lw(2);
fG = DFB1.lw(1);
f = (fG^5 + 2.69269*fG^4*fL + 2.42843*fG^3*fG^2 + 4.47163*fG^2*fG^3 + 0.07842*fG*fL^4 + fL^5)^(1/5);
eta = 1.36603*fL/f - 0.47719*(fL/f)^2 +0.011116*(fL/f)^3;  %Lorentzian percentage
[Field, Spec] = pepper(DFB1,Exp);
Spec = Spec/max(Spec);
Field = Field';
Spec = Spec';
%% Plot
figure
plot(B,spc,Field,(Spec))
