octave-bug-tracker
[Top][All Lists]

## [Octave-bug-tracker] [bug #30400] bug of interp2 for small number of ele

 From: Thorsten Meyer Subject: [Octave-bug-tracker] [bug #30400] bug of interp2 for small number of elements in xi and yi Date: Fri, 09 Jul 2010 18:34:41 +0000 User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.10) Gecko/20100623 Iceweasel/3.5.10 (like Firefox/3.5.10)

```URL:
<http://savannah.gnu.org/bugs/?30400>

Summary: bug of interp2 for small number of elements in xi
and yi
Project: GNU Octave
Submitted by: tmeyier
Submitted on: Fri 09 Jul 2010 06:34:40 PM UTC
Category: Libraries
Severity: 3 - Normal
Item Group: Incorrect Result
Status: None
Assigned to: None
Originator Name: Thorsten Meyer
Originator Email:
Open/Closed: Open
Discussion Lock: Any
Release: dev
Operating System: GNU/Linux

_______________________________________________________

Details:

trying a few things in the context of bug #29601, I stumbled across the
following strange behaviour:

demo example 7 for interp2 looks like this:
A=[13,-1,12;5,4,3;1,6,2];
x=[0,1,2]; y=[10,11,12];
xi=linspace(min(x),max(x),17);
yi=linspace(min(y),max(y),26)';
mesh(xi,yi,interp2(x,y,A,xi,yi,'cubic'));
[x,y] = meshgrid(x,y);
hold on; plot3(x(:),y(:),A(:),"b*"); hold off;

It works nicely with the present tip. This is also ok:
octave:41> interp2(x,y,A,xi(1:8),yi(1:4),'cubic')
ans =

Columns 1 through 6:

13.000000    9.773438    6.968750    4.585938    2.625000    1.085938
12.212800    9.302787    6.770550    4.616087    2.839400    1.440488
11.451200    8.845838    6.575950    4.641537    3.042600    1.779138
10.715200    8.402587    6.384950    4.662287    3.234600    2.101888

Columns 7 and 8:

-0.031250   -0.726562
0.419350   -0.224012
0.851150    0.258638
1.264150    0.721388

I get a 4 by 8 matrix of interpolated values corresponding to a 4by8 field of
value pairs at which to interpolate.

But this is not good:
octave:42> interp2(x,y,A,xi(1:3),yi(1:4),'cubic')
error: bicubic: A(I,J,...) = X: dimensions mismatch
error: called from:
error:   /home/thorsten/hg/octave/scripts/general/bicubic.m at line 186,
column 12
error:   /home/thorsten/hg/octave/scripts/general/interp2.m at line 346,
column 12

And this is at least strange:
octave:42> interp2(x,y,A,xi(1),yi(1),'cubic')
ans =

13   13   13   13

Why don't I get only one value for one value pair to be interpolated?

_______________________________________________________

<http://savannah.gnu.org/bugs/?30400>

_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/

```