Hi all,
I'm trying to automate a nonlinear regression routine and part of that involves creating a custom model via column formulas.
I want to have an arbitrary number of parameters, and I think I've solved that by dumping an appropriately formatted list into the Parameter({}) section ("Parm_Start"). One problem I'm having is that I don't know how to arbitrarily set the term in Match(). I tried to do this with Match_List{}, which matches the format, but it gives odd outputs.
Secondly, I'm trying to sum a series of exponentials with "o" pre-exponential terms and "o" using the form A[o]*exp(-t/t[o]) -- see the code below. The A's are all fittable parameters, pulled from a column Mod_Parm; Time is a column of arbitrary length and the independent variable; and Timeconst is a column of the same length as Mod_Parm (both of which are shorter than Time).
I haven't gotten to the part where the JSL-based nonlinear modeling routine is called because need to fix this first.
Thanks!
Mod_Parm_list={};
Parm_start={};
Parm_list={};
Match_list={};
b=1;
for(m=1,m<=num_exp,m++,
Mod_Parm_list[m]="A"||char(m);
Parm_start[m]=parse("Parm_"||Mod_Parm_list[m]||" = -0.1");
Parm_list[m]="Parm_"||Mod_Parm_list[m];
Match_list[b]=Mod_Parm_list[m];
Match_list[b+1]=parse(Parm_list[m]);
b=b+2;
);
dt << NewColumn("I_model",Format ("Scientific"),Set Property( "Expand Formula", 1 ),
Formula
(Parameter(
{Parm_start},
I_DC - Summation(o=1,num_exp,
Match(:Mod_Parm,
"A1", Parm_A1,
"A2", Parm_A2,
"A3", Parm_A3,
"A4", Parm_A4,
"A5", Parm_A5,
"A6", Parm_A6
)*Exp(-:Time/:TimeConst[o])
)
)
)
);