Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2003
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2003

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

Search the Archive

Re: Putting NonLinear fit into a For[ ] Loop

  • To: mathgroup at smc.vnet.net
  • Subject: [mg44461] Re: Putting NonLinear fit into a For[ ] Loop
  • From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
  • Date: Mon, 10 Nov 2003 19:55:46 -0500 (EST)
  • Organization: Universitaet Leipzig
  • References: <boig80$oh5$1@smc.vnet.net>
  • Reply-to: kuska at informatik.uni-leipzig.de
  • Sender: owner-wri-mathgroup at wolfram.com

Hi,

why do you have the Needs[] in the For[]-loop ??
and why the Needs[] has no ";" at it's end ?

Regards
  Jens

mhd wrote:
> 
> 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: Re: Integration
  • Next by Date: Re: NDSolve question
  • Previous by thread: Fwd: Putting NonLinear fit into a For[ ] Loop
  • Next by thread: Re: differences in Solve with -1/2 and -0.5Re: