Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2010

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

Search the Archive

Re: Can Mathematica interpolate non-uniform scatter data?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg106969] Re: Can Mathematica interpolate non-uniform scatter data?
  • From: JH <jlucio at ubu.es>
  • Date: Fri, 29 Jan 2010 07:50:28 -0500 (EST)
  • References: <hjmjgg$ee$1@smc.vnet.net> <hjon95$4ga$1@smc.vnet.net>

On 27 ene, 12:23, Lawrence Teo <lawrence... at yahoo.com> wrote:
> Hi DH,
>
> Did you miss out anything in your reply?
> How to do the interpolation with non-uniform scattered data (with
> holes)?
>
> On Jan 27, 2:42 pm, dh <d... at metrohm.com> wrote:
>
> > to do it. Anyway, here is it:
>
> > now we can do the interpolation:
>
> > Lawrence Teo wrote:
> > > Hi all,
>
> > > Can Mathematica interpolate non-uniform scatter data?
> > > Like ListInterpolation or Interpolation functions...
>
> > > z = {{0.`, 0.`, 0.`, 0.`, 0.`, 0.`, 0.`, 0.`, 0.`}, {0.`, ,
> > >     0.12467473338522769`, 0.18640329676226988`,
> > >     0.24740395925452294`, , 0.36627252908604757`,
> > >     0.42367625720393803`, 0.479425538604203`}, {0.`,
> > >     0.12467473338522769`, 0.24740395925452294`, 0.366272529086047=
57=
> `,
> > >     0.479425538604203`, 0.5850972729404622`, 0.6816387600233341`,=
 ,
> > >     0.8414709848078965`}, {0.`, 0.18640329676226988`,
> > >     0.36627252908604757`, 0.5333026735360201`, 0.6816387600233341=
`,
> > >     0.806081108260693`, 0.9022675940990952`, 0.9668265566961802`,
> > >     0.9974949866040544`}, {0.`, 0.24740395925452294`,
> > >     0.479425538604203`, 0.6816387600233341`, 0.8414709848078965`,
> > >     0.9489846193555862`, 0.9974949866040544`, 0.9839859468739369`=
,
> > >     0.9092974268256817`}};
> > > g = ListInterpolation[z, {{0, 1}, {0, 2}}];
> > > g[0.5, 0.5]
>
> > > However, the previous interpolation will give us a lot of NULL in the
> > > expression...
_______________________________________________________________________


Hello, Lawrence:

As far as I know, the answer is NOT YET (for more than one independent
variable). The subsequent question is obvious: WHY? (I don't know,
it's strange to me).

When dealing with data you know we have several options:

1. "Total" interpolation (look for a unique function --generally a
polynomial-- that passes thru all the points, as the Lagrange or
Hermite polynomials (1D) or generalizations for more dimensions, as
Shepard's. In Mathematica, for 1 indep. vble. we have
InterpolatingPolynomial[]).
2. "Local" or piecewise interpolation (as the Mathematica:
Interpolation[])
3. Fit (approximation of data). In Mathematica: Fit, FindFit, ...

For the first type, I have implemented some algorithms due to Shepard
(in 1968, not so modern!). Here I copy my implementation of one:

points= Table[xi = \[Pi] (2 Random[] - 1);yi = \[Pi] (2 Random[] - 1);
{xi, yi, Sin[xi] Cos[yi]},{9}];       note: few points, please

graphPoints = ListPointPlot3D[points, PlotStyle -> PointSize[0.04]];

Clear[n, vi, v];

n := Dimensions[points][[1]];

Array[vi, n];

Do[
  vi[i] = (\!\(
\*UnderoverscriptBox[\(\[Product]\), \(j = 1\), \(i - 1\)]
\*SuperscriptBox[\((
\*SuperscriptBox[\((x - \(points[[j]]\)[[1]])\), \(2\)] +
\*SuperscriptBox[\((y - \(points[[j]]\)[[
             2]])\), \(2\)])\), \(2\)]\)) (\!\(
\*UnderoverscriptBox[\(\[Product]\), \(j = i + 1\), \(n\)]
\*SuperscriptBox[\((
\*SuperscriptBox[\((x - \(points[[j]]\)[[1]])\), \(2\)] +
\*SuperscriptBox[\((y - \(points[[j]]\)[[
             2]])\), \(2\)])\), \(2\)]\)), {i, 1, n}];

v = \!\(
\*UnderoverscriptBox[\(\[Sum]\), \(i = 1\), \(n\)]\(vi[i]\)\);

funcionShepard2[xx_, yy_] := \!\(
\*UnderoverscriptBox[\(\[Sum]\), \(i =
     1\), \(n\)]\((\(points[[i]]\)[[3]]\
\*FractionBox[\(vi[i]\), \(v\)])\)\) /. {x -> xx, y -> yy}

graphSup =
 Plot3D[funcionShepard2[xx,
   yy], {xx, -\[Pi], \[Pi]}, {yy, -\[Pi], \[Pi]},
  PlotRange -> {{-\[Pi], \[Pi]}, {-\[Pi], \[Pi]}, {-1, 1}},
  ClippingStyle -> None]

Show[graphPoints, graphSup]

_____________________

For nD (n>1) Piecewise Interpolation of scattered (irregular) data,
one way is triangulation (in Mathematica we have DelaunayTriangulation
[], see Computational Geometry Package). But the interpolation
algorithm is not included in Mathem (I think).
_____________________

In a way, we can say Mathem. DOES HAVE (local) interpolation of
scattered data (2 indep. vbles), in List3DPlot[...], we can choose the
interpolation order, and Mathem. interpolates for a pretty drawing:
BUT THEY DON'T LET US USING THAT INTERPOLATION (Why???)

_____________________


I hope this has been useful for you.

  JH


  • Prev by Date: Re: More memory-efficient inner product for large last
  • Next by Date: Re: Re: Re: Re: More /.{I->-1} craziness. Schools
  • Previous by thread: Re: Can Mathematica interpolate non-uniform scatter data?
  • Next by thread: Frame