Page 1 of 1

Two component fitting

Posted: Mon Nov 11, 2024 8:15 pm
by Shamiul41

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);


Re: Two component fitting

Posted: Mon Nov 18, 2024 12:59 pm
by Stefan Stoll

It looks like you have some nonlinear baseline issues. Maybe try to correct them before fitting. Your spectrum clearly has two components. It could just be that you are stuck in a local minimum away from the global minimum.