Re: NonlinearFit + Sums
- To: mathgroup at smc.vnet.net
- Subject: [mg68799] Re: NonlinearFit + Sums
- From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
- Date: Sat, 19 Aug 2006 00:41:03 -0400 (EDT)
- Organization: The Open University, Milton Keynes, UK
- References: <ec3q7k$2fd$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Lyta wrote:
> Hi,
>
> I want to do a mulitdimensional nonlinear fitting and I'm not sure how to define the mathematica statement for that.
>
> I have a matrix "data" of dimensions 140x37 that contains 36 samples of 140 functions. The 37th column contains the resulting value of a mapping of the type R36->R1. I want to calculate the parameter mu of a function that integrates over the samples - i posted a simplified version of the function below. My problem is, that I don't know what to write instead of x_i. For the second x_ it should be something like {x1, x2, x3, x4, ..., x36}. But the first x_i should be something like x[[i]] (this doesn't work ofc). How do i assign the data to the sum?
>
> NonlinearFit[data, Sum[E^(mu)*x_i, {i, 1, 36}], x_i, {mu}]
>
> I hope you can help :-)
>
The following should do what your are looking for:
data = Table[Random[], {140}, {37}];
model = Plus @@ Table[E^mu*x[i], {i, 1, 36}]
Needs["Statistics`NonlinearFit`"]
NonlinearFit[data, model, Table[x[i], {i, 1, 36}], {mu}]
HTH,
Jean-Marc