Custom fitting methods for esfit

General forum for EasySpin: questions, how to's, etc.
Post Reply
katarkon
Local Expert
Posts: 214
Joined: Mon Jan 12, 2015 4:01 am

Custom fitting methods for esfit

Post by katarkon »

Can I use custom fitting methods for esfit()? Primarily interested in methods from MATLAB's Global Optimisation Toolbox. It seems similar to using the lsqnolin function from a similar Optimisation Toolbox.
This seems to require only minor changes to the esfit() source code, am I right?

Stefan Stoll
EasySpin Creator
Posts: 1136
Joined: Mon Jul 21, 2014 10:11 pm
Location: University of Washington

Re: Custom fitting methods for esfit

Post by Stefan Stoll »

This is currently not possible. All the optimization algorithms are hard-wired into esfit, and most of them are EasySpin implementations.

But there might be a workaround hack: Take your custom optimization function, wrap it with a function called lsqnonlin, make sure it has the same input syntax as lsqnonlin from the Optimization Toolbox, and use it with Opt.Method = 'lsqnonlin'.

katarkon
Local Expert
Posts: 214
Joined: Mon Jan 12, 2015 4:01 am

Re: Custom fitting methods for esfit

Post by katarkon »

Thanks. I see, esfit() calls lsqnonlin() at the form
[pfit_active,~,~,~,output] = lsqnonlin(residualfun,p0_active,lb_active,ub_active);
So, the outpust of the 'fake' lsqnonlin() should be the same, am I right?

Post Reply