forum.alglib.net

ALGLIB forum
It is currently Thu Mar 28, 2024 7:03 pm

All times are UTC


Forum rules


1. This forum can be used for discussion of both ALGLIB-related and general numerical analysis questions
2. This forum is English-only - postings in other languages will be removed.



Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: lsfit question with 2 variables
PostPosted: Thu Jan 19, 2012 4:55 pm 
Offline

Joined: Sat Jan 14, 2012 8:06 pm
Posts: 3
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_nlf

To 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!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC


Who is online

Users browsing this forum: Bing [Bot] and 51 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group