Re: Intepolation of an array with missing points

• To: mathgroup at smc.vnet.net
• Subject: [mg62341] Re: [mg62323] Intepolation of an array with missing points
• From: "Yasvir A. Tesiram" <tesiramy at omrf.ouhsc.edu>
• Date: Mon, 21 Nov 2005 03:54:24 -0500 (EST)
• References: <200511200419.XAA28564@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```G'day,

1. I suspect that when you Import the data, empty entries will be set to
Null. Now you have to make the decision as to what to do with the Null
entries.

e.g.

In[23]:=
lt={Null, 1, 2.0, 3.0 , Null, 4.0}

Out[23]=
{Null,1,2.,3.,Null,4.}

In[24]:=
lt/.Null -> 0.0

Out[24]=
{0.,1,2.,3.,0.,4.}

Alternatively, you may want to make it the average of the two numbers
flanking it.
Either way, Interpolation doesn't care and will represent your data
exactly.
Since your data will be a list of lists, you will want to Interpolate over
each row and each column. Here is some code that Interpolates an arrayed
data set and allows you to build a bigger data set.

sharpenCSI[data_, origSize_, finalSize_] := Module[{int},
int = Interpolation /@ data;
Table[#[i], {i, 1, origSize[[2]],
origSize[[2]]/
finalSize[[2]]}] & /@ (Interpolation /@ (Transpose[
Table[#[i], {i, 1, origSize[[1]],
origSize[[1]]/finalSize[[1]]}] & /@ int])) //
Transpose
]

You can use ListContourPlot, ListDensityPlot etc to visualize such data
sets.
Hope this helps.

Cheers
Yas

On Sat, 19 Nov 2005, dkjk at bigpond.net.au wrote:

> Hi,
>
> I have an array representing the heights of a surface over the x-y
> plane. Unfortunately, the heights at several points are unknown so have
> been replaced by empty strings. For an example, see
>
> http://users.bigpond.net.au/jdstokes/output.csv
>
> arr = Import["output.csv"] // MatrixForm
>
> My ultimate goal is to create an interpolating function of this data
> which will allow me to produce a contour plot. As a very inexperienced
> user of Mathematica, my initial thoughts have been someting like this:
>
> 1. Convert arr to an list of 3-tuples, ignoring the empty entries. (not
> sure how to do this)
> 2. Use Interpolation to create an InterpolatingFunction which can be
> plotted in ContourPlot.
>
> Does anyone know of a simple method to achieve 1. and whether or not 2.
> will work in this case?
>
> Thanks.
>
> James
>

```

• Prev by Date: Re: Confusing results with N[expr]?
• Next by Date: Re: Hardcopy or electronic books?
• Previous by thread: Intepolation of an array with missing points
• Next by thread: Re: Intepolation of an array with missing points