Hello,
is there possibility to printout after fitting the EPR spectrum with ESFIT also parameters of lsq1 (FitOpt.Scaling = 'lsq1';)?
And also I would like to ask how to directly print to text file info about best fit parameters after finishing ESFIT?
ESFIT print to MATLAB console e.g.
Best-fit parameters:
g: 2.006248
lwpp(2): 0.2198318
A(1): 38.41927
A(2): 133.5821
A(3): 36.86013
Residuals of best fit:
rmsd 0.0795227
I and would like to automatically print it to text file.
Thank you for any hint in advance
Radovan
lsq1
-
- EasySpin Guru
- Posts: 32
- Joined: Wed Jan 20, 2016 11:35 am
Re: lsq1
You have to run esfit such that it returns the best-fit parameters in a structure.
The structure bestsys contain the best-fit parameters. The simplest way to store this information is to use the matlab command save. However, this will not generate a textfile but a mat-file (you need matlab to open these files). If you need it in a text file you have to write a loop over all fields of the structure and print them with fprintf.
Code: Select all
bestsys = esfit('pepper',sn,FitSys,Vary,Exp);
Re: lsq1
Thank you for help.
Finally, I solved it with this one line command:
writetable(struct2table(BestSys), 'D:\MATLAB\myfitparam.txt')
which creates txt file with following content:
g,Nucs,A_1,A_2,A_3,lwpp_1,lwpp_2,weight
2.00623559139005,"N,P,H",38.7415138085437,133.047458565127,35.1752243125145,0,0.159081132661415,1
Once more, thank you
Radovan
Finally, I solved it with this one line command:
writetable(struct2table(BestSys), 'D:\MATLAB\myfitparam.txt')
which creates txt file with following content:
g,Nucs,A_1,A_2,A_3,lwpp_1,lwpp_2,weight
2.00623559139005,"N,P,H",38.7415138085437,133.047458565127,35.1752243125145,0,0.159081132661415,1
Once more, thank you
Radovan
Re: lsq1
I have made a script for visualization of the fitting results some time ago viewtopic.php?f=8&t=311 May be some ideas from it will be useful for solving of your problem.