Hi all. I am trying to use the "lsfit_d_nlf" example for a more complex function.
http://www.alglib.net/translator/man/ma ... sfit_d_nlfTo fit without weights one must use:
Code:
XAlglib.lsfitcreatef(x, y, c, diffstep, state)
If the function is for example:
Code:
func = System.Math.Exp(-c(0) * x(0) * x(0)) + 4 * c(2) * Cos(c(1))
and declare
Code:
Dim c() As Double = New Double() {1, 0.5, 2}
everything runs smoothly.
But, if I have a function like:
Code:
func = System.Math.Exp(-c(0) * x(0) * x(0)) + 4 * c(2) * Cos(c(1)) + g()
' (Of course this gives an error)where
Code:
Dim g() as Double = New Double() {0,2,4,6,8,10,12,14,16,18,20}
and with array size = array size of x and y because y=
f(x,g,c) and changes values as x index increases, how can I do the fit?
In other words, I would like to do a fit having 3 columns of values x,y,g (two independent variables) and the adjustable parameter c.
The question is in VB.net but please in the reply use whatever lang! thanks!