MathGroup Archive 2000

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

Search the Archive

Re: Interpolation for a 3Dplot

  • To: mathgroup at smc.vnet.net
  • Subject: [mg23008] Re: [mg22979] Interpolation for a 3Dplot
  • From: Hartmut Wolf <hwolf at debis.com>
  • Date: Tue, 11 Apr 2000 23:18:27 -0400 (EDT)
  • Organization: debis Systemhaus
  • References: <200004081844.OAA05367@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Chandrika Krothapalli schrieb:
>  
> I have a 3d surface plot, and some points in the {x,y} plane for which I have
> to calculate the z-value that corresponds to this surface plot. I was trying to
> use Interpolation function in mathematica, but I could not figure out the right
> way to use it. Can U tell me how to use it or tell me  any book that has
> material about this.....

Chandrica,

it depends from where you got your plot. Assuming this is from
ListPlot3D[<array-of-data>], then you can use Interpolation:

Assume we have an array of data, and a plot

In[1]:= 
arr = Table [y (1 - y)( x^2 - 1), {y, 0., 1., 1/12}, {x, -2., 2., 0.4}];
In[2]:= ListPlot3D[arr]

In[3]:= Dimensions[arr]
Out[3]= {13, 11}

and get the interpolation function:

In[4]:=  MapIndexed[Append[#2, #1] &, arr, {2}];
In[5]:=
ipf = Interpolation at Flatten[MapIndexed[Append[#2, #1] &, Transpose[arr],
{2}], 1]
Out[5]=
InterpolatingFunction[{{1., 13.}, {1., 11.}}, "<>"]

Regard the Transpose! If you now plot 

In[6]:= Plot3D[ipf[x, y], {x, 1., 11.}, {y, 1., 13.}]

you'll see that this reproduces the ListPlot3D above. So if you read off
some coordinates from the first plot, you may calculate the
corresponding z-value from the InterpolationFunction.

If you want to read a book:

    "Mathematica Graphics: Techniques & Applications",
    by Tom Wickham-Jones 

http://store.wolfram.com/view/ISBN0387940472/?38F16F89-050E


Hartmut


  • Prev by Date: Chop?
  • Next by Date: Re: RE:graphics export to LAtek and Word
  • Previous by thread: Interpolation for a 3Dplot
  • Next by thread: Problems with InitializationCell