Re: Function Fitting To 3D Data

• To: mathgroup at smc.vnet.net
• Subject: [mg53663] Re: Function Fitting To 3D Data
• From: "Astanoff" <astanoff at yahoo.fr>
• Date: Sat, 22 Jan 2005 03:51:43 -0500 (EST)
• References: <csl1jv\$6ue\$1@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```Assuming a linear fitting, this is the way I would do it :

In[1]:=
data={{3,2,13.9},{3,5,13.4},{3,10,12.3},{12,1,15.6},
{24,2,16.0},{60,5,14.1},{120,10,13.0},{240,20,11.7}};

ff[x_,y_]=Fit[data,{1,x,y},{x,y}];
alldata=
Flatten[Table[If[MemberQ[data[[All,{1,2}]],{x,y}],
First@Cases[data,{x,y,_}],{x,y,ff[x,y]}],
{x,1,240},
{y,1,20}],1];
f=Interpolation[alldata]

Out[4]=
InterpolatingFunction[{{1.,240.},{1.,20.}},<>]

In[5]:=f[1,1]
Out[5]=15.0536

In[6]:=f[3,2]
Out[6]=13.9

In[7]:=f[3,4]
Out[7]=14.0519
In[8]:=f[3,5]
Out[8]=13.4

In[9]:=f[240,20]
Out[9]=11.7

hth

Valeri

```

• Prev by Date: Re: PlotLegend not an option for PLot? 5.1
• Next by Date: Re: Preventing Times[x,x] from becoming Power[x,2]
• Previous by thread: Function Fitting To 3D Data
• Next by thread: Re: Re: Function Fitting To 3D Data