MathGroup Archive 2003

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

Search the Archive

Fwd: Putting NonLinear fit into a For[ ] Loop

  • To: mathgroup at smc.vnet.net
  • Subject: [mg44426] Fwd: Putting NonLinear fit into a For[ ] Loop
  • From: mhd <mhd at wsu.edu>
  • Date: Sat, 8 Nov 2003 04:51:06 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

I got it working. thanks though, mathematica just needed to be closed and 
reopened I guess. then the below worked fine.

Clear["nfits*"]
Needs["Statistics`NonlinearFit`"]
For[i = 1, i <= Length[datasetnames], i++1,
Evaluate[ToExpression["nfits" <> ToString[i] <> "[x_]"]] =
NonlinearFit[Evaluate[ToExpression["fluordata" <> ToString[i]]], 
Amp*E^(-E^(-x+9.8)/w)-x-9.8)/w+1),{x}, {Amp, w}, MaxIterations -> 100] ]








>To: mathgroup at smc.vnet.net
>From: mhd <mhd at wsu.edu>
To: mathgroup at smc.vnet.net
>Subject: [mg44426] Putting NonLinear fit into a For[ ]  Loop
>
>Seems like this should have been easy to Find a mathematica eg...
>
>I have hunderds of data files, each with two "gausian peaks"
>I want to import the files Fit one Peak and subtract it from the file 
>leaving the other peak. I can get the code to work fine if I do only one 
>file. I put it into the For [ ] Loop and get stuck. I am testing with 5 
>data files, all imports fine in the loop then hits the below code and I 
>get one fit out or none and errors
>
>any suggestion on how to do this or a link to an example...
>Thanks
>
>Dudley
>Dept of Physics
>WSU
>
>Clear["Ffit*"]; Clear["fit*"];
>For[i = 1, i <= Length[datasetnames], i++,
>
>   Needs["Statistics`NonlinearFit`"]
>
>        Evaluate[ToExpression["fitted" <> ToString[i]]] =
>     NonlinearFit[Evaluate[ToExpression["fluordata" <> ToString[i]]],
>       yo+Amp*E^((-E^((-x + 9.8)/w)) - (x - 9.8)/w + 1), x, {y0,Amp,w},
>       MaxIterations -> 1800]
>
>     ]  (*  < --- Closes For[] statement  *)
>
>Set::write: Tag Times in fitted1Null is Protected.   more...



  • Prev by Date: Re: Re: FourierTransform of Sinc Function
  • Next by Date: Re: Re: Re: FourierTransform of Sinc Function
  • Previous by thread: Putting NonLinear fit into a For[ ] Loop
  • Next by thread: Re: Putting NonLinear fit into a For[ ] Loop