Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Multi-dimensional curve fitting

104 views
Skip to first unread message

Lagbaja

unread,
Mar 11, 2011, 8:08:05 PM3/11/11
to
Hello,

I need help on a curve fitting problem and I'm new to Matlab.

I need non-linear fitting of multiple data sets of X and Y (i.e. X1,Y1, X2,Y2,.....) to an expression with a single set of variables. The expression is of the form
Y=f[k, a, b, I(E,X)], where a, b and E are the variables I'm looking for.
k relates to the different curves I'm trying to fit (i.e k1 relates to X1,Y1 data set, k2 to X2,Y2, and so on).

One more complication in this problem is that I(E,X) is an exponential integral that should be solved numerically using expint.

Can anyone give hints as to how to approach this problem? I'm guessing lsqnonlin is the optimization function to use, but I need help iin applying it.

Torsten

unread,
Mar 14, 2011, 3:43:56 AM3/14/11
to

If (X_{1,i1},Y_{1,i1}) (1<=i1<=n1), (X_{2,i2},Y_{2,i2})
(1<=i2<=n2) ... are your data sets,
the equations to implement for lsqnonlin or lsqcurvefit are
Y_{1,i1}-f(k_{1},a,b,I(E,X_{1,i1}) = 0 (1<=i1<=n1)
Y_{2,i2}-f(k_{2},a,b,I(E,X_{2,i2}) = 0 (1<=i2<=n2)
...

Best wishes
Torsten.

Lagbaja

unread,
Mar 14, 2011, 5:37:05 PM3/14/11
to
Thanks for the quick response Torsten,

Could you help with writing the function file. Like i said, I'm rather new to matlab and neither of the tutorial files for lsqnonlin or lsqcurvefit give an indication on how to introduce multiple datasets. For instance according to tutorials for lsqcurvefit, fitting the function
ydata = x1*exp[(x2)*xdata] is done as follows:

function F = myfun(x,xdata)
F = x(1)*exp(x(2)*xdata);

How then would I introduce x1data, y1data; x2data, y2data and so on?

Would it then be:
function F1 = myfun(x1,x1data), F2 =myfun(x2,x2data).....?

Looking forward to your response.

Regards,

L

Torsten <Torsten...@umsicht.fraunhofer.de> wrote in message <db7e1407-715d-489d...@m7g2000vbq.googlegroups.com>...

0 new messages