Page 1 of 1

esfit save the theoretical spectrum generated with the best parameters

Posted: Mon Apr 06, 2020 2:02 am
by yvesjour
Firstly, I hope that all members of this forum are well and unaffected by this terrible epidemic.

I'm not a Matlab expert and I don't know how to add to my script the instructions to save the theoretical spectrum generated with the best parameters when the fit has converged or if I stop it with the command on the GUI.

The script just behind save the spectrum with the starting values not with the best parameters.

Is it possible to generate the best parameters spectrum without writing another script using pepper with the best parameters.

Thank you for your help

clear

[B,spc]=textread('/Users/yves/ownCloud/Articles.en.cours/Marion.NiCuNi/simu.RPE/RPE.10.2018/NiCuNiopba4K.txt','%f, %f');

Sys.S = [3/2];

light=physconst('LightSpeed')

Sys.g= [2.1335 2.2347 2.0584];
Sys.D=[8.8810e+04 2.7929e+04];
Sys.DFrame=[0.0049 -0.1326 -0.0082];
Sys.HStrain=[1.4732e+03 841 3.3308e+03];


Exp.Range = [0 600];
Exp.Temperatue=[4.];
Exp.mwFreq = 9.34137787;

SimOpt.nKnots = 35;

SimOpt.Method ='matrix';

Vary.D=[500 150];
%Vary.g=[0.01 0.01 0.01];
%Vary.DFrame=[0.01 0.01 0.01];
%Vary.HStrain=[200 200 350];

Sys0 = Sys;
Sys0.D = Sys.D;
%Sys0.g=Sys.g;
%Sys0.DFrame=Sys.DFrame;
%Sys0.HStrain=Sys.HStrain;


FitOpt.Method = 'simplex';

%FitOpt.Scaling = 'maxabs';
FitOpt.Scaling = 'lsq';

esfit('pepper',spc,Sys,Vary,Exp,SimOpt,FitOpt)

[H, I]= pepper(Sys, Exp, SimOpt);

plot(H, I*5000,'r',B,spc,'b');

data = [H(:) I(:)];
save('theo.RPE.opba.3demiseul.simplex.toutparam.txt','data','-ascii');

Re: esfit save the theoretical spectrum generated with the best parameters

Posted: Mon Apr 06, 2020 9:04 am
by Stefan Stoll
Try [BestSys,BestSpc] = esfit(...). See documentation.

In the esfit GUI you can also click on Export to save the currently best-fit spin system to the MATLAB workspace.

Re: esfit save the theoretical spectrum generated with the best parameters

Posted: Tue Apr 07, 2020 2:10 am
by yvesjour
Thank you very much
I will try, just a question. three dots are enough in the esfit(...) parenthesis.
best regards

Yves