Page 1 of 1

Multifrequency fitting in multicomponent system

Posted: Sun Oct 24, 2021 9:13 am
by skoutsoukos

Hello,

I was wondering if anybody has used esfit for multifrequency fitting in multicomponent systems (for CW spectra).
In order to be more specific, I have 2 components (let’s name them Sys1A and Sys1B). The way I currently set up the simulations is defining the system for X band like that:
Sys1A.Nucs = '14N, 1H';
Sys1B.Nucs = '14N';
.
.
.
(with all appropriate parameters for the simulation – g, lw, tcorr and weight)
And then for the Q band I define Sys2A and Sys2B, which are equal to their X-band analogues (apart from lw).

As far as I understand, for multifrequency esfit I practically need to add the spectra one next to each other in one vector and simulate them with one set of parameters for both frequencies (again, apart from lw – where I would set one lw.X and one lw.Q). However, I don’t understand how this could be done when I have 2 components in my system.

Has anybody managed to make this work, or is there another function that does this which I'm not aware of?

Thanks,
Spiros


Re: Multifrequency fitting in multicomponent system

Posted: Sun Oct 24, 2021 1:40 pm
by katarkon

You may use Sys.lw field to define both X and Q band linewidths
Sys.lw = [lwX lwX; lwQ lwQ] where [lwX lwX] are gaussian and lorentzian components for X band and [lwQ lwQ] for Q band.
During simulation just parse lw field
SysX=rmfield(Sys,'lw'); %X band
SysQ=SysX; %Qband
SysX.lw=Sys.lw(1,:); %extract lw
SysQ.lw=Sys.lw(2,:);
...
spcX=garlic(...,SysX,..); %simulation
spcQ=garlic(..,SysQ,...);
spc=[spcX spcQ]; %combine spectra


Re: Multifrequency fitting in multicomponent system

Posted: Sun Oct 24, 2021 3:13 pm
by skoutsoukos

Thanks for the reply. I am doing actually something very similar. I am saving initially all my parameters as Sys.gX1, Sys.gX2, Sys.Q1, Sys.Q2 etc and i have made a function which then picks the parameters it needs for each component and renames them to the corresponding Sys (so Sys.gX1 becomes SysX1.g etc).
I have managed saving all of my parameters under as one Sys. and one Exp. and it seems to work manually (plots the simulated combined spectra when I give it Sys and Exp), but when I put the function on esfit I get the error Too many input arguments.
That's why I asked whether somebody else has faced something similar.


Re: Multifrequency fitting in multicomponent system

Posted: Mon Oct 25, 2021 2:42 am
by katarkon

Are you write your custom simulation function?


Re: Multifrequency fitting in multicomponent system

Posted: Mon Oct 25, 2021 4:47 am
by skoutsoukos

Yes, I have modified the chili_multifreq script to include 2 components for each frequency.


Re: Multifrequency fitting in multicomponent system

Posted: Tue Oct 26, 2021 1:45 am
by katarkon

Please give all of the scripts here.


Re: Multifrequency fitting in multicomponent system

Posted: Tue Oct 26, 2021 2:13 am
by skoutsoukos

Here I attach the script and the function. I also attach the 2 model measurements I've been working on.
Thanks again for the help.


Re: Multifrequency fitting in multicomponent system

Posted: Tue Oct 26, 2021 10:33 am
by katarkon

Try to rewrite your custom simulation function to accept three parameters (Sys,Exp,Opt) instead two ones (Sys,Exp). It should be compatible with esfit() function.


Re: Multifrequency fitting in multicomponent system

Posted: Tue Oct 26, 2021 11:44 am
by skoutsoukos

You are right! Adding SimOpt.Verbocity=[] actually makes it work.
Thanks so much for that! :D