MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Why this function does not return a single value

  • To: mathgroup at smc.vnet.net
  • Subject: [mg60342] Re: Why this function does not return a single value
  • From: Marek Bromberek <marekbr at gmail.com>
  • Date: Wed, 14 Sep 2005 03:27:11 -0400 (EDT)
  • References: <dg696f$a2u$1@smc.vnet.net>
  • Reply-to: marekbr at gmail.com
  • Sender: owner-wri-mathgroup at wolfram.com

 Hi Bill

 If You run the code from my previous post You will see how my data looks
like because I adjusted the parameters in the lists a, b, \[Delta]L and
\[Delta]G so that it represents my data quite well.
However I want to use NonlinearFit (or FindFit) to find the values of those
parameters which best represent my data.

Regards

Marek



Bill Rowe wrote:

> On 9/10/05 at 10:36 PM, marekbr at gmail.com (Marek Bromberek) wrote:
> 
> 
>>Thanks Bill for Your reply. It makes a few things clear.
> 
> Glad to help.
> 
>>Let me explain what I want to do (probably it was not entirely
>>clear from my original post). I want to fit a sum of 15 Voight
>>functions to a dataset. Initially I thought that by making all the
>>parameters as an array I would be able to use Sum function so that
>>a[i], b[i] and c[i] would refer to the parameters of i-th peak in
>>the sum. However I could not get this to work. (see my original
>>post). Following Paul's suggestions I did the following
> 
>>I defined the Voigt function
> 
>>Voigt[x_, (a_)?NumericQ, (b_)?NumericQ, (\[Delta]L_)?NumericQ,
>>(\[Delta]G_)?NumericQ] :=
>>(a*(2.*Log[2.]*\[Delta]L)*NIntegrate[1/(E^t^2*(((Sqrt[Log[2.]]*\[
>>Delta]L)/\[Delta]G)^2 + ((Sqrt[4.*Log[2.]]*(x - b))/\[Delta]G -
>>t)^2)), {t, -Infinity, Infinity}])/(Pi^(3/2)*\[Delta]G)
> 
>>then I defined lists of parameters
> 
>>a = {6224., 2122., 1936., 4261., 7275., 19059., 5057., 3209.,
>>3586., 3792.,
>>6182., 1993., 1615., 737., 3114.};
>>b = {5.49, 9.87, 11.17, 13.91, 14.83, 16.92, 17.91, 19.44, 21.91,
>>22.8, 23.9, 26.0, 29.75, 30.97, 33.99}; \[Delta]L = {0.5, 0.5, 0.5,
>>0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5};
>>\[Delta]G = {0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5,
>>0.5, 0.5, 0.5, 0.5};
> 
>>Then I defined another function for plotting purposes like so:
> 
>>Fu[x_] := Plus @@ Thread[Voigt[x, a, b, \[Delta]L, \[Delta]G]]
> 
>>And that allows me to plot what I want
> 
>>Plot[Fu[x] + 4680.*Exp[(-Log[2.])*((x - 27.4)^2/15^2)] +
>>6569*Exp[-x/2.57], {x, 0, 40}, ImageSize -> {600, 400}, PlotRange
>>-> All]
> 
>>But I have no idea how to do the NonlinearFit with that function.
>>Any help would be greatly appreciated
> 
> It still isn't clear to me what it is you want to do. Your code defines
> parameters for 15 instances of your function which you sum. You say you
> are trying to fit this sum to a data set using NonlinearFit. But you don't
> really explain what you mean by fitting this sum to a data set. What does
> your data set look like? What unknown parameters are you trying to
> esitmate?
> 
> As an aside, I will mentiion the functionality of NonlinearFit is fully
> contained in the built in function FindFit. I suspect (but haven't
> verified) FindFit will be faster than NonlinearFit. Also, FindFit has a
> bit more flexibility in that it provides for a mechanism to monitor
> convergence and allows for different norms.
> 
> --
> To reply via email subtract one hundred and four


  • Prev by Date: Re: Re: Timed Notebooks for Student Take-home examinations
  • Next by Date: Re: Timed Notebooks for Student Take-home examinations
  • Previous by thread: Re: Why this function does not return a single value
  • Next by thread: Re: Why this function does not return a single value