Hi, I have been working with the curry function for some time now and I wondered if an expansion of the function to handle multiple components is in the pipeline? I am in need of fitting some data with multiple spin structures.
- love the software!
Hi, I have been working with the curry function for some time now and I wondered if an expansion of the function to handle multiple components is in the pipeline? I am in need of fitting some data with multiple spin structures.
This can be solved quite flexibly with an auxiliary function that calculates several components and returns the total susceptibility to be fitted by esfit.
For a guy who is not a master of the MatLab languages how would that look like?
Thank you for the feedback. However, it still seems to me that pepper copes with multiple Sys components and curry does not, like pepper({Sys1, Sys2},Exp,Opt) is something pepper understands and curry does not. Maybe I just don't understand how to bypass this.
Yes, hence the use of the custom function.
In the custom function, you define an arbitrary number of systems using parameters and experimental conditions you enter in your script. You then calculate the contributions of each system by calling curry
separately for each of them.
You then add them up and the total susceptibility is exported as y.
That y is fitted by esfit.
In the main script:
Code: Select all
Sys.S1 = 1/2;
Sys.g1 = [g1xy g1z]
Sys.weight1 = w1;
...
Sys.S2 = 1;
Sys.g2 = [g2xy g2z]
Sys.weight2 = w2;
...
esfit(@mufunc,Sys,Vary,Exp,Opt,FitOpt);
And:
Code: Select all
function y = mufunc(Sys,Exp,Opt)
fullSys1.S = Sys.S1
fullSys1.g = Sys.g1
fullSys1.J = ..
fullSys2.S = Sys.S1
fullSys2.g = Sys.g2
fullSys2.J = ..
etc
sus1 = curry(fullSys1,Exp,Opt)
sus2 = curry(fullSys2,Exp,Opt)
y = Sys.weight1 * sus1 + Sys.weight2 * sus2
return