Re: How to use the multiple varible Interpolation?

• To: mathgroup at smc.vnet.net
• Subject: [mg26298] Re: [mg26169] How to use the multiple varible Interpolation?
• From: Tomas Garza <tgarza01 at prodigy.net.mx>
• Date: Sun, 10 Dec 2000 00:20:08 -0500 (EST)
• Sender: owner-wri-mathgroup at wolfram.com

```I notice you haven't had an answer from the group yet, so I thought I
might venture a possible approach. First, when you say you have "many"
points, I expect they are many more than those in your example "tab".
The trouble with "tab" is that you have a very incomplete grid in the
x-y plane.  The thing is, for y = 0 you have the x- values {-5, -4,
-3, 0, 3, 4, 5} , whereas for y = 2 you have only the x-values {-3,
-2, 0, 2, 3}. This makes it very awkward to work with.
Anyway, my approach would be to get an interpolation function for each y
value and using it, complete your observations for all values of x =
{-4, -3, -2, -1, 0, 1, 2, 3, 4} (I omit x = -5 and 5 in order to avoid
too many negative z-values). You would then have 27 points on a regular
grid. Then you may use ListInterpolation to estimate the value at any
x,y point.

To illustrate the point, I obtain an "augmented tab", say tabAug , with
two-dimensional interpolated values at all the original missing points:

In[61}:=
tabAug
Out[61]=
{{{-4, 0, 1.}, {-3, 0, 2.}, {-2, 0, 3.}, {-1, 0, 4.}, {0, 0, 5.}, {1, 0,

4.}, {2, 0, 3.}, {3, 0, 2.}, {4, 0, 1.}}, {{-4, 1, 0.}, {-3, 1,
1.}, {-2, 1, 2.19048}, {-1, 1, 3.28571}, {0, 1, 4.}, {1, 1,
3.28571}, {2, 1, 2.19048}, {3, 1, 1.}, {4, 1, 0.}}, {{-4, 2,
-0.6}, {-3,
2, 0.}, {-2, 2, 0.8}, {-1, 2, 1.8}, {0, 2, 3.}, {1, 2, 1.8}, {2,
2,
0.8}, {3, 2, 0.}, {4, 2, -0.6}}}

which you may compare with your original tab. Then I use
ListInterpolation on tabAug:

In[62]:=
vals = Transpose[Partition[Flatten[tabAug], 3]
Out[62]=
{1., 2., 3., 4., 5., 4., 3., 2., 1., 0., 1., 2.19048, 3.28571, 4.,
3.28571, 2.19048, 1., 0., -0.6, 0., 0.8, 1.8, 3., 1.8, 0.8, 0., -0.6};

In[63}:=
h = ListInterpolation[Partition[vals, 9], {{0, 2}, {-4, 4}}]
ListInterpolation::"inhr": "Requested order is too high; order has been
reduced to {2, 3}"
Out[63]=
InterpolatingFunction[{{0., 2.}, {-4., 4.}}, "<>"]

We check the quality of the 3-dimensional interpolation:

In[64]:=
Table[h[i, j], {i, 0, 2}, {j, -4, 4}]
Out[64]=
{{1., 2., 3., 4., 5., 4., 3., 2., 1.}, {0., 1., 2.19048, 3.28571, 4.,
3.28571,
2.19048, 1., 0.}, {-0.6, 0., 0.8, 1.8, 3., 1.8, 0.8, 0., -0.6}}

which is obviously very good in comparison with "vals" above.

In[65]:=
h[1.5, 3.5]
Out[65]=
0.034375

I'm sure that a more decent set of observations "tab" will get you very
reasonable results.

Tomas Garza
Mexico City

"liwen liwen" <gzgear at yahoo.com> wrote:

>              Now I have many points which are on a 3D
> surface.
> for
> example,tab={{-5,0,0},{-4,0,1},{-3,0,2},{0,0,5},{3,0,2},
> {4,0,1},{5,0,0},
> {-4,1,0},{-3,1,1},{0,1,4},{3,1,1},{4,1,0},
> {-3,2,0},{-2,2,0.8},{0,2,3},{2,2,0.8},{3,2,0}};
> I want to find the z value of (x=3.5,y=1.5) by the
> method
> of Interpolation,what should I do?
> Is there any other method to solve those problem like
> this?

```

• Prev by Date: Re: TeXSave undefined control sequences
• Next by Date: Re: Re: Re: embedding Mathematica equations in MS Word part 2
• Previous by thread: Re: Graphics3D[Plot3D[]] vs. ParametricPlot3D[]
• Next by thread: "?" to find symbols