MathGroup Archive 2003

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

Search the Archive

Putting NonLinear fit into a For[ ] Loop

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

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: Numerical Optimization of Procedural Function
  • Next by Date: Re: Part 2 of a recent post on Plot and v 5
  • Previous by thread: Numerical Optimization of Procedural Function
  • Next by thread: Fwd: Putting NonLinear fit into a For[ ] Loop