Custom simulation function (Error: Not enought input arguments)

General forum for EasySpin: questions, how to's, etc.
Post Reply
kulrich
Newbie
Posts: 2
Joined: Tue Apr 01, 2025 7:36 am

Custom simulation function (Error: Not enought input arguments)

Post by kulrich »

Hello,

I am trying to figure out how to use custom simulation functions for coupled parameters. Therefore, I am executing an example from Easyspin Acadamy 2020 (code provided below). However, when starting the fitting procedure in the GUI the fitting does not beginand the following log message appears.

"Running optimization algorithm with 1 active parameters...
Simulation function error:
Not enough input arguments."

Does anyone know which part of the code this refers to or how to fix this?

Thanks in advance!

I am running the code on Matlab R2024a with Easyspin 6.0.6

Code: Select all

clear, clf, clc

Sys.g=2;
Sys.Nucs = '1H, 1H, 1H';
Sys.n = [2 3 2];
Sys.A = [20; 30; 50];
Sys.lwpp =  [0 0.1];

Exp.mwFreq = 9.5;
Exp.Range = [330 350];


[B,spc_exp] = garlic(Sys,Exp);
spc_exp = addnoise(spc_exp,100,'f');
plot(B,spc_exp);

Sys.myA = 20;
Vary.myA = 5;

esfit(spc_exp,@mysimfun,{Sys, Exp}, {Vary});

function spc= mysimfun(Sys,Exp,Opt)
    Sys.A = Sys.myA*[1, 1.5, 2.5];
    spc = garlic(Sys,Exp,Opt);
end
katarkon
Local Expert
Posts: 212
Joined: Mon Jan 12, 2015 4:01 am

Re: Custom simulation function (Error: Not enought input arguments)

Post by katarkon »

You try to use diffrenent parameter's set for custom simulation function and esfit(). I mean Opt parameter.

kulrich
Newbie
Posts: 2
Joined: Tue Apr 01, 2025 7:36 am

Re: Custom simulation function (Error: Not enought input arguments)

Post by kulrich »

Thank you!

Post Reply