graphical user interface shows incomplete fitting results
Dear Easyspin team,
My MATLAB fitting only shows RMSD, and no information about goodness of fit (chi-square specifically).
May i know if there is something wrong with the code i wrote? And how can i find the chi-square in this case?
Thanks.
Best regards,
Jennifer
clear, clc
[B,spc] =eprload(');
B = B/10;
[CorrSpec,BLine] = basecorr(spc);
plot(B, spc);
hold on;
legend('spectrum','baseline');
Exp.mwFreq=9.873634;
%Experimental Parameters ===========================
Exp.Range=[min(B) max(B)]; %from the min of B to max of B
Exp.nPoints= numel(-spc);% or numl(B); 9.775784
spc = addnoise(spc,150,'n');
Sys0.S=1/2;
Sys0.Nucs='14N, 1H';
Sys0.n=[1 1];
g_offset0 = +0.009;
Sys0.g=2.00 + g_offset0;
Sys0.A=[14.9 14.9]*2.802;
Sys0.lwpp=[0.1 0.1];
Sys1.S=1/2;
Sys1.Nucs='14N,1H,1H';
Sys1.n=[1 1 1];
g_offset1=0.00759;
Sys1.g=2+g_offset1;
Sys1.A=[16.4 22.5 22.5]*2.802;%H radical
Sys1.lwpp=[0.15 0.15];
Sys2.S=1/2;
Sys2.Nucs='14N,1H';
Sys2.n=[1 1 ];
g_offset2 = +0.008;
Sys2.g=2.00 + g_offset2;
Sys2.lwpp=[0.12 0.15];
Sys3.S=1/2;
Sys3.Nucs='14N';
Sys3.n=[1 ];
%g_offset3 = +0.0074;
Sys3.g=2.00 + g_offset0;
Sys3.A=[15.3]*2.802;%DMPOO
Sys3.lwpp=[0.2 0.32];
Sys4.S=1/2;
Sys4.Nucs='14N,1H';
Sys4.n=[1 1 ];
g_offset4 = +0.008;
Sys4.g=2.00 + g_offset4;
Sys4.A=[15.6 20.8]*2.802;%CH2OH
Sys4.lwpp=[0.23 0.23];
Vary0.g=0.02;
Vary0.A=[0.05 0.05];
Vary0.lwpp=[0.05 0.05];
Vary1.A=[0.05 0.05 0.05];
Vary1.lwpp=[0.05 0.05];
Vary2.g=0.02;
Vary2.A=[0.01 0.01];
Vary2.lwpp=[0.05 0.05];
Vary3.A=[0.01];
Vary3.lwpp=[0.05 0.05];
%Vary4.g=0.02;
Vary4.A=[0.01 0.01];
Vary4.lwpp=[0.05 0.05];
[Bsim, spc_sim] = garlic(Sys0,Exp);
%spc_sim = rescale(spc_sim,spc,'lsq');
[Bsim,spc_sim1]=garlic(Sys1, Exp);
[Bsim,spc_sim2]=garlic(Sys2, Exp);
[Bsim,spc_sim3]=garlic(Sys3, Exp);
[Bsim,spc_sim4]=garlic(Sys4, Exp);
total=spc_sim4+spc_sim2%+spc_sim4%+spc_sim2%+spc_sim4;
figure(2); clf;
plot(B,spc./max(spc));
hold on;
plot(Bsim, total./max(total));
% We also can provide options for the simulation function.
SimOpt.Method = 'perturb';
% Finally, we specify the fitting algorithm and what should be fitted.
FitOpt.Method = 'simplex int'; % simplex algorithm, integrals of spec
esfit(@garlic,spc,Sys0,Vary0,Exp,SimOpt,FitOpt);
%esfit(@garlic,spc,Sys1,Vary,Exp,SimOpt,FitOpt);
%esfit(@garlic,spc,{Sys0,Sys3,Sys2},{Vary0,Vary3,Vary2},Exp,SimOpt,FitOpt);
%esfit(@garlic,spc,{Sys0,Sys3},{Vary0,Vary3},Exp,SimOpt,FitOpt);
%esfit(@garlic,spc,Sys3,Vary,Exp,SimOpt,FitOpt);