MathGroup Archive 2006

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

Search the Archive

Re: Interpolating data

  • To: mathgroup at smc.vnet.net
  • Subject: [mg64115] Re: Interpolating data
  • From: "Valeri Astanoff" <astanoff at yahoo.fr>
  • Date: Thu, 2 Feb 2006 00:05:01 -0500 (EST)
  • References: <drpvo2$ml4$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

My method to gridify the data (not very orthodox ! ) :

In[1]:=
aaa = {{0, 3, -4.7202`}, {0, 7, 17.5902`}, {-20, 0, -0.418`}, {-10, 0,
17.3249`}, {0, 0, -9.9187`}, {5, 0, -46.7828`}, {17.5`, 0, -51.2055`},
{-15,
        5, -5.1367`}, {
7.5`, 5, 17.2389`}, {-17.5`, 10, -4.0567`}, {-5, 10, 17.4435`},
{0, 10, 16.4173`}, {5, 10, 9.0035`}, {0, 12.5`, 9.4378`}, {0, 15,
15.1786`}, {0, 17.5`, 15.3475`}, {0, -2, -54.6795`}, {20, 0, 17.5902`},
{10,
        0, 17.3249`}, {-5, 0, -9.9187`}};

In[2]:=xi=aaa[[All,1]]//Union

Out[2]={-20,-17.5,-15,-10,-5,0,5,7.5,10,17.5,20}

In[3]:=yi=aaa[[All,2]]//Union

Out[3]={-2,0,3,5,7,10,12.5,15,17.5}

In[4]:=
near[x_,y_]:=
    (t= Rest/@
          Take[Sort[{(x-#[[1]])^2+(y-#[[2]])^2,
                    Sequence@@#}&/@aaa],3];
      Fit[t,{1,u,v,u^2,v^2,u v},{u,v}]/.u\[Rule]x/.v\[Rule]y);

In[5]:=
bbb=Table[{x=xi[[i]],y=yi[[j]],near[x,y]},
        {i,1,Length[xi]},
        {j,1,Length[yi]}]//Flatten[#,1]&;

In[6]:=f=Interpolation[bbb]

Out[6]=InterpolatingFunction[{{-20.,20.},{-2.,17.5}},<>]

In[7]:=f[0,3]

Out[7]=-4.7202

In[8]:=f[0,5]

Out[8]=4.23799

In[9]:=f[0,7]

Out[9]=17.5902


hth

v.a.


  • Prev by Date: Re: does anybody know how to find the inverse Laplace transform of this wierd thing?
  • Next by Date: New MathCode Functionality Expands Options for Prototyping C++ and Fortran 90 Applications in Mathematica
  • Previous by thread: Re: Interpolating data
  • Next by thread: Re: Interpolating data