Two component fitting
I am new in easy spin. I am trying to fitting an epr spectra using the following code. but i am not getting the exact fitting. Can you guys help me to find out what i need to change for the fitting
[B, spc] = eprload("Sample_8_2.DTA");
figure;
plot(B, spc);
Sys1.g = [2.007, 2.006, 2.003];
Sys1.A=[6.7 6.7 35];
Sys1.Nucs = '14N';
Sys1.weight =100;
Sys1.lwpp =4.8; % mT
Sys2.g = [2.005, 2.004, 2.001];
Sys2.A=[6.7 6.7 35];
Sys2.weight = 1;
Sys2.Nucs = '14N';
Sys2.lwpp =0.2; % mT
Sys1.logtcorr = -9;
Sys2.logtcorr = -9.5;
Exp.mwFreq = 9.5; % GHz
Exp.Range = [337 340.7]; % mT
Exp.nPoints = 1024;
[Ba,yfit1] = chili(Sys1,Exp);
[Ba,yfit2] = chili(Sys2,Exp);
yfitsum = yfit1 + yfit2;
%plot(B,spc,xa,yfit1,xa,yfit2,xa,yfitsum)
% Next we set up the least-squares fitting.
% First comes a starting set of parameters (which we obtain by reusing
% the spin systems from the simulation and changing a few values)
Sys = {Sys1,Sys2};
% Next, we specify which parameter we want to be fitted and by how much
% the fitting algorithm can vary it.
Vary1.g = [0 0.003 0];
Vary2.g = [0 0.003 0];
Vary1.A=[1 1 1];
Vary2.A=[1 1 1];
Vary1.weight=10
Vary2.weight = 1;
Vary1.lwpp = 0.3; % Allow slight variations for Sys1
Vary2.lwpp = 0.1; % Allow more variation for Sys2
Vary1.logtcorr = 1;
Vary2.logtcorr = 1;
Vary = {Vary1, Vary2}; % Now includes variability for the third system
% Call the fitting function
SimOpt.Method = 'perturb';
FitOpt.Method = 'simplex int'; % simplex algorithm, integrals of spectra
esfit(spc,@chili,{Sys,Exp, SimOpt},{Vary}, FitOpt);