Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'Variable number of parameters' topicStudent Support Forum > General > "Variable number of parameters"

Next Comment >Help | Reply To Topic
Author Comment/Response
simplexe
11/19/06 09:52am

Hi all.

Let's say I want to do a non linear least squares fit of exp(x) on interval [0.25, 5] with some combination of c_i x^i, i=0, .., n.
How can I do to set n=3 for example and perform the fit and then try again with another value for n (ie, only n changes and the set of parameters gets more c_i's) ??

I tried :
----------------------
data = Table[{x, Exp[x]}, {x, 0.25, 5, 0.025}];
n= 3;
n = 3;
NonlinearFit[data, NSum[c_i x^i, {i, 0, n}], x, Table[c_i, {i, 0, n} ]]
----------------------
But I only got errors .. ?


URL: ,

Subject (listing for 'Variable number of parameters')
Author Date Posted
Variable number of parameters simplexe 11/19/06 09:52am
Re: Variable number of parameters simplexe 11/23/06 05:22am
Re: Variable number of parameters Forum Modera... 11/23/06 09:21am
Re: Variable number of parameters simplexe 11/24/06 09:35am
Next Comment >Help | Reply To Topic