Indeed, it looks more flexible to use.
On this topic I have a related question which I post on this thread.
As I had posted in the past, and believed to have found an answer to my problem (
viewtopic.php?f=3&t=332#p1023), I wanted to scale the two subspectra to the sum spectrum and experimental data so that I can plot together. So I invoked esfit like so to extract the calculated sum spectrum:
Code: Select all
[BestSys,BestSpc] = esfit('decompose',spc,{Sys1,Sys2},{Vary1,Vary2},Exp,[],FitOpt);
datafname = [fname,'_fitcurve.txt'];
calcdata = [B(:) BestSpc(:)];
save(datafname,'calcdata','-ascii');
and then I recalculated the sum in my fitting function like you suggested:
Code: Select all
function [x,y] = decompose_v2(Sys,Exp,Opt)
[x,y_monomer] = pepper(Sys{1},Exp,Opt);
[x,y_trimer] = pepper(Sys{2},Exp,Opt);
calc_monomer = y_monomer'; save('Cu7_monomer.txt','calc_monomer','-ascii');
calc_trimer = y_trimer'; save('Cu7_trimer.txt','calc_trimer','-ascii');
figure(234);
plot(x,y_monomer)
drawnow
hold on
plot(x,y_trimer)
drawnow
hold off
y = y_monomer + y_trimer;
calc_total = y'; save('Cu7_total.txt','calc_total','-ascii');
end
I was expecting that Cu7_total.txt = constant * ...fitcurve.txt, and that by multiplying the subspectra with that constant would give me the scaled subspectra.
However, I found that this is not the case: the sum of the subspectra from my fitting function and the calculated spectrum are not exactly the same. Do you have any suggestions as to why that is?
The calculations are from my posted experimental spectra so that you can corroborate, and I confirm the result with the 5.1.8 version.
Thanks,
Thanasis