I am wondering if it is possibe showing every component during fitting.
OR,can users have the option to choose showing any of the multi-components after fitting stopped.
Is it possibe showing components during mutli-compon fitting
-
- EasySpin Creator
- Posts: 1120
- Joined: Mon Jul 21, 2014 10:11 pm
- Location: University of Washington
Re: Is it possibe showing components during mutli-compon fit
Unfortunately, this is currently not possible.
Re: Is it possibe showing components during mutli-compon fit
One workaround I have found is to write a very simple custom function which esfit will invoke. All it does is to plot one of the two systems. The selection is done depending their distinguishing characteristics:
This will plot the contribution of the system with g>=2.3 in a separate Matlab Figure window. Unfortunately, I haven't found a way to export two plots (pasting the same command in both places only returns one output).
However, it is better than nothing...
Code: Select all
function [x,y] = decompose(Sys,Exp,Opt)
if Sys.g(1,2)>=2.32
[x,y] = pepper(Sys,Exp,Opt);
plot(x,y);
elseif Sys.g(1,2)<2.32
[x,y] = pepper(Sys,Exp,Opt);
end
end
However, it is better than nothing...
-
- EasySpin Creator
- Posts: 1120
- Joined: Mon Jul 21, 2014 10:11 pm
- Location: University of Washington
Re: Is it possibe showing components during mutli-compon fit
I think you could use
figure(234)
and subplot
to achieve this. Put each of the spectra in a separate subplot.Re: Is it possibe showing components during mutli-compon fit
I modified the code to:
and I do get a nice panel with the two plots, but only after the calculation.
I must confess that did not understand the
I tried to insert a
Code: Select all
function [x,y] = decompose(Sys,Exp,Opt)
if Sys.g(1,2)>=2.32
[x,y] = pepper(Sys,Exp,Opt);
monomer=y' ; save('monomer','monomer','-ascii');
subplot(2,1,1);
plot(x,y)
elseif Sys.g(1,2)<2.32
[x,y] = pepper(Sys,Exp,Opt);
subplot(2,1,2);
plot(x,y)
trimer=y' ; save('trimer','trimer','-ascii');
end
end
I must confess that did not understand the
figure(234)
command. Is is something like figure(h)
as mentioned in Matlab manuals?I tried to insert a
figure
command at the beginning of the script, but I got a whole bunch of figures after the end of the calculation.Re: Is it possibe showing components during mutli-compon fit
Correction:
The previous code worked excellently, giving a panel with the two components changing in real time during the fit, but only when the fit was invoked through the GUI with
It did not work well when it was invoked so that the output was saved to an ascii, through:
Still it is a good progress.
The previous code worked excellently, giving a panel with the two components changing in real time during the fit, but only when the fit was invoked through the GUI with
esfit('decompose',spc,{Sys1,Sys2},{Vary1,Vary2},Exp,[],FitOpt);
.It did not work well when it was invoked so that the output was saved to an ascii, through:
[BestSys,BestSpc] = esfit('decompose',spc,{Sys1,Sys2},{Vary1,Vary2},Exp,[],FitOpt);
.Still it is a good progress.
-
- EasySpin Creator
- Posts: 1120
- Joined: Mon Jul 21, 2014 10:11 pm
- Location: University of Washington
Re: Is it possibe showing components during mutli-compon fit
The command
figure(234)
activates figure no 234, or creates it if not already created. This makes Matlab plot in the same window when called repeatedly. You might need to issue drawnow
after the plot commands, to force Matlab to do the plotting. Otherwise, Matlab tries to be smart and plot only at the overall end of the calculation.Re: Is it possibe showing components during mutli-compon fit
Yes, that did it:
Now it works also without the GUI fitting option!
Code: Select all
function [x,y] = decompose(Sys,Exp,Opt)
figure(234)
if Sys.g(1,2)>=2.32
[x,y] = pepper(Sys,Exp,Opt);
monomer=y' ; save('monomer','monomer','-ascii');
subplot(2,1,1)
plot(x,y)
drawnow
elseif Sys.g(1,2)<2.32
[x,y] = pepper(Sys,Exp,Opt);
trimer=y' ; save('trimer','trimer','-ascii');
subplot(2,1,2)
plot(x,y)
drawnow
end
end