Page 1 of 1
EasySpin plots simulation *before* fit, not *after* fit
Posted: Sat Jan 25, 2020 1:14 pm
by pyrabbo
Hi, I'm new to easyspin and having this troubling error on both a PC and mac installation of the latest version of EasySpin 5.2.27 (with Matlab R2019b)
When I attempt to plot my fitted data, it plots only the simulated data *before* the fit. I can't seem to access the X,Y parameters of the fitted data in any format. This same code worked flawlessly with previous versions of Matlab & Easyspin.
Code: Select all
plot (B, spc/max(spc), B, pepper(Sys, Exp, fit1)/max(pepper(Sys,Exp,fit1)))
1) Simulation before fit:
https://ibb.co/2qtXHdq
2) Simulation after fit:
https://ibb.co/t3BLt1x
3) Plot result (wtf?):
https://ibb.co/10YLfVQ
I'd be grateful for any suggestions. Thanks in advance!
Re: EasySpin plots simulation *before* fit, not *after* fit
Posted: Mon Jan 27, 2020 12:03 pm
by Stefan Stoll
Please post your script, including the data and the start parameters that you use to run esfit.
Re: EasySpin plots simulation *before* fit, not *after* fit
Posted: Mon Jan 27, 2020 12:27 pm
by pyrabbo
Code: Select all
Sys.g = [2.2 2.2 2.2];
Sys.S = 3/2;
Exp.Range = [10 490]
Temperature = 15.7;
Exp.mwFreq = 9.630866;
Sys.nPoints = 1024;
Exp.nPoints = 1024;
Code: Select all
Sys.lwpp = [0 8];
EoverD = 0.33;
D = 40000
Sys.D = [D D*EoverD];
Sys.DStrain = [10000 1];
pepper (Sys,Exp);
Opt.Method = 'matrix';
Code: Select all
Vary.g = [0.3 0.3 0.3];
Vary.lwpp = [12 1];
Vary.D = [10000 1000];
Vary.DStrain = [6000 1];
esfit('pepper',spc,Sys,Vary,Exp);
I run the fitting program with:
Method: Nelder/Mead simplex
Target: data as is
Scaling: scale & quad.
Startpoint: Selected parameter set
Then hit "save parameter set," "export," and I plot it using the "plot" command from the first post.
I also get the "Spectrum exceeds sweep range. Artifacts a upper limit possible." error
Re: EasySpin plots simulation *before* fit, not *after* fit
Posted: Mon Jan 27, 2020 12:43 pm
by Stefan Stoll
Please post your data file, so we can try to reproduce this.
Re: EasySpin plots simulation *before* fit, not *after* fit
Posted: Mon Jan 27, 2020 12:49 pm
by pyrabbo
oh sorry, here is the text file.
https://easyupload.io/yzqy8u
Re: EasySpin plots simulation *before* fit, not *after* fit
Posted: Fri Jan 31, 2020 11:56 am
by Stefan Stoll
It appears you are including a quadratic background correction in your fit. The spectrum plotted by esfit
will include this, and the spectrum simulated with pepper not. Use rescale
to include it.
Re: EasySpin plots simulation *before* fit, not *after* fit
Posted: Fri Jan 31, 2020 2:52 pm
by pyrabbo
i'm not entirely convinced this is only a scaling-issue. i can adjust the scaling in excel, but it still looks nothing like the fitted dataset:
https://ibb.co/F0rWXy0
regardless, how do I include *rescale* in here? i keep getting error messages...
Re: EasySpin plots simulation *before* fit, not *after* fit
Posted: Fri Jan 31, 2020 4:23 pm
by Stefan Stoll
I would not use
lsq2
(scale and quadratic baseline) in
esfit
in your case. Use
lsq0
(scale and shift) or
lsq
(scale only) instead.
If
spc_exp
is your experimental spectrum, and
spc_sim
is the simulated one use,
Code: Select all
spc_sim = rescale(spc_sim,spc_exp,'lsq2')
Then,
spc_sim
will include an additional quadratic polynomial background that improves the fit with the experimental spectrum.