Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re: Data interpolation

20 views
Skip to first unread message

BBabic

unread,
May 14, 2013, 3:15:36 AM5/14/13
to
I have exactly the same problem.
I can plot list of data with form{{x,y,z}}, with ListDensityPlot.
However, the interpolation or ListInterpolation do not get similar result or complain that it is not rectangular grid.
Since the data can be easyly plotted and interpolated using ListDensityPlot can somebody from Mathematica developers explain us how it is done for this purpose.
Or how we can get the numbers {z} from ListDensityPlot.
Thank you !

P.S. I have read many threads about the same subject, it seems to be serious issue which is not properly addressed.

Bob Hanlon

unread,
May 16, 2013, 3:28:20 AM5/16/13
to

Without an example it is difficult to address your specific issue. Here is
an interpolation function:

data =
Table[
With[
{r = RandomReal[{0, 5}], t = RandomReal[{0, 2 Pi}]},
{r Cos[t], r Sin[t], Sin[r^2]/r^2}],
{2*10^4}];


f = Interpolation[{Most[#], Last[#]} & /@ data,
InterpolationOrder -> 1];


g[x_?NumericQ, y_?NumericQ] :=
f[x, y]*Boole[x^2 + y^2 <= 25]


Grid[{
{ListDensityPlot[data,
ImageSize -> 300],
Plot3D[g[x, y], {x, -5, 5}, {y, -5, 5},
PlotRange -> All,
RegionFunction ->
Function[{x, y, z}, x^2 + y^2 < 25],
ImageSize -> 300]},
{DensityPlot[g[x, y], {x, -5, 5}, {y, -5, 5},
RegionFunction ->
Function[{x, y, z}, x^2 + y^2 <= 25],
ImageSize -> 300],
ContourPlot[g[x, y] == 0, {x, -5, 5}, {y, -5, 5},
RegionFunction ->
Function[{x, y, z}, x^2 + y^2 <= 25],
ImageSize -> 300]}}] // Quiet



Bob Hanlon
0 new messages