Multi-component esfit with different functions possible?

General forum for EasySpin: questions, how to's, etc.
Post Reply
warly
Newbie
Posts: 3
Joined: Thu Mar 10, 2016 10:36 am

Multi-component esfit with different functions possible?

Post by warly »

Hello,
is it possible to simulate a spectrum with multiple components with esfit,
where I need to use different functions for the different components?
For example for the more immobile component chili and for the fast component garlic.
I guess I have to write a user-defined simulation function for this, but I wasn't successful.
Could somebody give me a hint how to write such a function?

Thanks & regards!
joscha_nehrkorn
EasySpin Guru
Posts: 32
Joined: Wed Jan 20, 2016 11:35 am

Re: Multi-component esfit with different functions possible?

Post by joscha_nehrkorn »

Code: Select all

function y = myfit(Sys,Exp,Opt)
if nargin<3, Opt=struct(); end
Sys_garlic = Sys;
Sys_garlic.g = Sys.g_garlic;
Sys_garlic.logtcorr = Sys.logtcorr_garlic;
Sys_chili = Sys;
Sys_chili.g = Sys.g_chili;
Sys_chili.logtcorr = Sys.logtcorr_chili;
yg = garlic(Sys_garlic,Exp,Opt);
yc = chili(Sys_chili,Exp,Opt);
y = yg +yc;
should do it when only g and logtcorr should be different, but I guess it is clear how to expand this.
It is a quick and dirty code, but should do your job.
Post Reply