Skip to main content
1 of 3
VladM
  • 93
  • 7

FitRegularization with a user function

I am trying to use FindFit with a user-defined function g[a] for FitRegularizaton as specified in the document. Say, I have parameters a1,a2,a3,a4 and define g[a] as

g[a_]:=Sum[a[i]*10^(4-i),{i,1,4}]

i.e. I want the parameters of the fit to decrease as powers of 10. However, when I write

FindFit[data,function,{a1,a2,a3,a4},x,FitRegularization->g],

I get the error FindFit: The fit regularization g should be a function or named regularization.

What is the correct way of writing it? I tried "g" instead of g and other variants, it is not working. I also can not find any examples of its use.

VladM
  • 93
  • 7