forum.alglib.net
http://forum.alglib.net/

Help lsfitcreatefg with multivariate function
http://forum.alglib.net/viewtopic.php?f=2&t=2242
Page 1 of 1

Author:  Raymond [ Mon Feb 16, 2015 8:27 am ]
Post subject:  Help lsfitcreatefg with multivariate function

Hello. First of all, thank you for all the work on this library.

I am currently trying to do a fit on a multivariate function and I wanted to use the lsfit subpackage which seems the more suited to my needs.
However I have difficulties understanding how to create the function to fit when the points are multidimensional.

Taking the example from the documentation, what I understand is that if I want to fit for example C in the following function, X being a 2 dimensional variable:

f(C) = C[0]exp(X[0]) + C[1]exp(X[1])

I should declare my function as:

void function_cx_1_func(const real_1d_array &C, const real_2d_array &x, double &func, void *ptr)
{

func = C[0]*exp(x[0][0]) + C[1]*exp(x[0][1]);
}

Is it right or did I miss something? Do I proceed the same to use "3d" points (x[0][0], x[0][1], x[0][2])?

Any help would be greatly appreciated. Thank you in advance for your answer.

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/