esfit userdefined function pepper
Posted: Mon Feb 11, 2019 3:51 am
Dear community,
I would like to fit an solid state EPR spectrum, using a user defined function for simulation with pepper. There are 2 spin Systems: (S =1/2, 4 equivalent N nuclei, axial system) and (S=1/2, 4 equivalent N nuclei, 1 Au nucleus, rhombic system). I found in the EasySpin documentation of esfit how to define user defined functions for constraint fitting:
http://easyspin.org/easyspin/documentat ... #multicomp
This works well for a one component System. When modifying to a 2 component System, I obtain the following error message:
______________________________________________________________
Struct contents reference from a non-struct array object.
Error in Constraints (line 3)
fullSys0.A = [Sys0.A(1,:); Sys0.A(2,:); Sys0.A(2,:); Sys0.A(2,:); Sys0.A(2,:)];
____________________________________________________________________
esfit is defined as:
esfit('Constraints',spc,{Sys0,Sys1},{Vary0,Vary1},Exp,SimOpt,FitOpt);
with the user defined function Constraints.m:
function y = Constraints(Sys0,Sys1,Exp,Opt)
fullSys0 = Sys0;
fullSys0.A = [Sys0.A(1,:); Sys0.A(2,:); Sys0.A(2,:); Sys0.A(2,:); Sys0.A(2,:)];
% Sys0.A is an 2x3 Array with the A tensor of Au (1st row) and N (2nd row) in the struct Sys0.
fullSys0.Nucs = 'Au,N,N,N,N';
fullSys1 = Sys1;
fullSys1.A = [Sys1.A; Sys1.A; Sys1.A; Sys1.A];
fullSys0.Nucs = 'N,N,N,N';
Opt.Method = 'perturb';
[x,y] = pepper({fullSys0,fullSys1},Exp,Opt)
end
I would be pleased, if somebody could give some hints.
Thank you in Forward,
Christoph
I would like to fit an solid state EPR spectrum, using a user defined function for simulation with pepper. There are 2 spin Systems: (S =1/2, 4 equivalent N nuclei, axial system) and (S=1/2, 4 equivalent N nuclei, 1 Au nucleus, rhombic system). I found in the EasySpin documentation of esfit how to define user defined functions for constraint fitting:
http://easyspin.org/easyspin/documentat ... #multicomp
This works well for a one component System. When modifying to a 2 component System, I obtain the following error message:
______________________________________________________________
Struct contents reference from a non-struct array object.
Error in Constraints (line 3)
fullSys0.A = [Sys0.A(1,:); Sys0.A(2,:); Sys0.A(2,:); Sys0.A(2,:); Sys0.A(2,:)];
____________________________________________________________________
esfit is defined as:
esfit('Constraints',spc,{Sys0,Sys1},{Vary0,Vary1},Exp,SimOpt,FitOpt);
with the user defined function Constraints.m:
function y = Constraints(Sys0,Sys1,Exp,Opt)
fullSys0 = Sys0;
fullSys0.A = [Sys0.A(1,:); Sys0.A(2,:); Sys0.A(2,:); Sys0.A(2,:); Sys0.A(2,:)];
% Sys0.A is an 2x3 Array with the A tensor of Au (1st row) and N (2nd row) in the struct Sys0.
fullSys0.Nucs = 'Au,N,N,N,N';
fullSys1 = Sys1;
fullSys1.A = [Sys1.A; Sys1.A; Sys1.A; Sys1.A];
fullSys0.Nucs = 'N,N,N,N';
Opt.Method = 'perturb';
[x,y] = pepper({fullSys0,fullSys1},Exp,Opt)
end
I would be pleased, if somebody could give some hints.
Thank you in Forward,
Christoph