Re: problems with memory usage
- To: mathgroup at smc.vnet.net
- Subject: [mg63314] Re: problems with memory usage
- From: Bill Rowe <readnewsciv at earthlink.net>
- Date: Fri, 23 Dec 2005 05:08:37 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
On 12/20/05 at 11:35 PM, marcellesantos at yahoo.com (Marcelle Santos) wrote: >I have to fit a model to a long set of data from previous >calculations. These data are in a file called "ptab.m", which has >this structure: >{k1,{{x1,y1},{x2,y2},{x3,y3},...}} >{k2,{{x1,y1},{x2,y2},{x3,y3},...}} The primary tool for fitting models to data is FindFit which handles both linear and non-linear models. FindFit wants to see the data list in the form of an nXm matrix. So, I assume what you need to do is transform the data structure into something FindFit accepts, i.e., In[17]:= data = {{k1,{{x1, y1}, {x2, y2}, {x3, y3}}}, {k2, {{x1, y1}, {x2, y2}, {x3, y3}}}}; In[18]:= Join @@ Transpose /@ (Join[{Table[First[#1], {Length[Last[#1]]}]}, Transpose[Last[#1]]]&)/@ data Out[18]= {{k1, x1, y1}, {k1, x2, y2}, {k1, x3, y3}, {k2, x1, y1}, {k2, x2, y2}, {k2, x3, y3}} -- To reply via email subtract one hundred and four