Levenberg-Marquardt: funcs


cwen
12-19-2002, 08:16 AM
Hi,
I am trying to use mrqmin to fit a non-linear function. For the input funcs(float x,float a[], float *y, float dyda[], int na).
My function is like:
y = a[1] *exp(- ((a[2] - x)/a[3]).^2)
a[1], a[3] are two coefficient that I want to get from mrqmin.
But a[2] is a parameter as an input for funcs(). For example, I need it be: a[2] = 2. So I made ia[2] = 0. Is this to make a[2] fixed to what I want or I need set : dyda[2] = 0 ?
Thank you for your help.

John_P
01-29-2003, 02:21 PM
cwen,
Just setting ia[2]=0 should take care of it. Once you have done that, it doesn't matter what dy/da[2] is because it isn't used to adjust a[2]. Thus, just keep it as its actual value so if at some later time you also want to fit for a[2], you can.

John