MATLAB >> interpolation and extrapolation

If a matrix is given as [1 2 3; 4 ? 9;3 1 9], is there any function in
matlab which can find the value of '?' by 2D interpolation?

If the matrix is [ ? 2 3; 4 5 9; 3 19], is there any function to find '?' ?

Thanks.

Goshiwen

MATLAB >> interpolation and extrapolation

Hi Goshiwen,
the case of interpolation is quite easy:
help griddata

x=[1 2 3 1 3 1 2 3];
y=[1 1 1 2 2 3 3 3];
z=[1 2 3 4 9 3 1 9];
[XI,YI]=meshgrid(1:3,1:3);
ZI=griddata(x,y,z,XI,YI);
surf(XI,YI,ZI);

Titus

?

MATLAB >> interpolation and extrapolation

In article < XXXX@XXXXX.COM >,
XXXX@XXXXX.COM (Goshiwen) writes:
>If a matrix is given as [1 2 3; 4 ? 9;3 1 9], is there any function in
>matlab which can find the value of '?' by 2D interpolation?
>
>If the matrix is [ ? 2 3; 4 5 9; 3 19], is there any function to find '?' ?
>
>Thanks.
>
>Goshiwen

no. you must have an idea on what "matrix" represents.
if you think on data z over the (i,j)-plane then ? can be just any value.
if you think of these 9 values as the values of a biquadratic or a
continuous piecewise linear function in i and j it can be any value.
if you decide it should be linear in i and quadratic in j, then you have
sufficient data to compute this function and can evaluate it on the unknown
point. so it is your decision which makes the problem solvable or unsolvable
hth
peter

MATLAB >> interpolation and extrapolation

In article < XXXX@XXXXX.COM >,

Take a look at inpaint_nans on matlab central.
It is designed to do exactly this.

HTH,
John D'Errico

--

The best material model of a cat is another, or
preferably the same, cat.
A. Rosenblueth, Philosophy of Science, 1945

MATLAB >> Interpolation and extrapolation

Hello,

my problem is:

i have this vectors:

X=[ 1 2 3 4];

Y=[ 5 15 16 3];

and
XI=[ 0 0.5 1.5 3.5 4.3 6];

if I do:

YI=interp1(X,Y,XI,'nearest','extrap');

I get the values of YI on XI points according to the nearest
interpolation,but, what could i do if i'm looking for a pchip
interpolation for the elements of XI are inside the interval [1 4]
and a nearest interpolation for the elements are outside this
interval?

i know that i can divide the XI vector into two parts depending on
if the element of XI is either inside or outside interval [1 4], but
do you know a easy way?

MATLAB >> Interpolation and extrapolation

Simplest is to clip.

YI=interp1(X,Y,min(max(X),max(min(X),XI)),'pchip');

HTH,
John D'Errico

```Hi everyone,

hope I am not hitting to much of an evergreen here...

I want to do 4-D piecewise linear interpolation and extrapolation.
interpn works great for values inside the range but reports NaNs
outside.
Of course, it is conceptually not difficult to program a
multidimensional piecewise linear interpolation oneself. So my
concern is: if I write my own code it's likely to be slower than the
optimized Mathworks code. But I need to do the approximation so often
that speed is crucial. Does anyone see a simple way to "fix" interpn
for my purposes?
I am not necessarily looking for a solution from somebody else but
for a good strategy: try to write it all on my own or just try to
deal with the NaNs in the output I get from interpn?

jasper
```

```I have a scattered 3-D polar grid data (X,Y,Z converted to Cartesian, data from Lidar) and 'W' at every location on the Grid.  I need to interpolate and extrapolate these wind speeds (W) on a +45m terrain following surface (complex).  How can I use F = TriScatteredInterp(X,Y,Z,W) to get the function (F) and then use the terrain co-ods to get the wind speeds at those locations.

The actual size of X = 50(range gates) x 300 (beams) x 10(scans), the +45m surface is somewhere in between these data points.
The size I Input into Triscatteredinterp, since it requires vector form of data
X =15000x10, Y = 15000x10, Z = 15000x10, W= 15000x10.
When I use TriScatteredInterp it gives me an error saying "Input data point locations have invalid dimension."  If I Input just one column it gives me a surface which I can use for interpolation, why does it not work for more than one column of data?

Is there any other method which can do both interpolation and some degree of extrapolation too??  Similar Issues with Griddata3 and interp3.  Not sure how to efficiently use these commands for my purpose, grid problems!!

Eventually I will have to do this for 10 days worth of data (the above example is just 10 mins).  Please explain.
```

```Hi all,

I have a problem on the extrapolation, i have surface in 'height'
data, in the circular form,this is freeform surface height.

The problem is i want to extrapolate the circular form into
rectangular form, hence i need to fill in the blank region (because
from circular to rectangular you will have blank region at 4 corners)
with new height.

Until now i can't find the good extrarpolation method to find the new
height data to fill in the blank region, m that can give me continuos
surface.

Thanks
```

```I need to extrapolate a pont using function interp1. I discovered that I must use the parameter 'extrap' in order to do this.

>> t = 1900:10:1990;
p = [75.995  91.972  105.711  123.203  131.669...
150.697  179.323  203.212  226.505  249.633];
>>  x = 1900:1:2000;
y = interp1(t,p,x,'spline'); % interpolate and plot
plot(t,p,'o',x,y)

My question is how ca I interpolate a certain point using interp1 function extrap function.

In documentation I cannot see any example.

Can you help me pls?
```