bugGNU Octave - Bugs: bug #43418, ...


bug #43418: interp2(X,Y,Z,iX,iZ,"spline") fails when iX,iZ are matrices

Submitted by:  Malte Hinrichs <maldje>
Submitted on:  Tue 14 Oct 2014 06:52:14 PM UTC  
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  Confirmed Assigned to:  None
Originator Name:  Malte Hinrichs Open/Closed:  Open
Release:  dev Operating System:  Any

Add a New Comment (Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


( Jump to the original submission)

Fri 16 Dec 2016 07:39:53 PM UTC, comment #6: 

This issue is still present in Octave 4.2.0.

When I run the script from comment #3, then I still get an error message from Octave, where as Matlab is reported to run fine on this script.

Hartmut <hardy>
Wed 26 Nov 2014 10:35:17 AM UTC, comment #5: 

I found a workaround using interpn instead of interp2. I also discovered a bug in interpn when using spline-interpolation, which I will report separately.

I have included an example file: test_interp2c.m

In short the workaround is:

iZ=zeros(size(iPHI)); % workaround for bug in interpn

iZ is initialized to the correct format first, because spline-interpolation only works correctly with vector-input. With matrices it delivers incorrect results:


(file #32546)

Malte Hinrichs <maldje>
Wed 12 Nov 2014 08:11:24 PM UTC, comment #4: 

Marking the bug as confirmed.

Rik <rik5>
Project Administrator
Wed 12 Nov 2014 07:16:05 PM UTC, comment #3: 

Please excuse the delay. I did not have access to matlab before today. I modified the script for matlab-compatibility (test_interp2b.m)

It works fine in matlab but not in octave. In my opinion this confirms the bug.

XI and YI do not need to be in mesh grid format. Only X,Y,Z do.

Also linear interpolation works fine in octave. The bug only concerns spline interpolation.

(file #32424)

Malte Hinrichs <maldje>
Mon 03 Nov 2014 11:12:13 PM UTC, comment #2: 

Do you have access to Matlab to test how it behaves?  The error message is pretty specific

interp2: XI, YI must have uniform spacing ('meshgrid' format)

and happens to be true.  iPHI and iR are definitely not in meshgrid format.

The Matlab documentation just describes the data being in meshgrid format, but I can't tell whether this is also true of the requested interpolation range as well.

Rik <rik5>
Project Administrator
Tue 14 Oct 2014 07:16:38 PM UTC, comment #1: 

Forget about the first example file. It contains an error.  Use this one.

(file #32273)

Malte Hinrichs <maldje>
Tue 14 Oct 2014 06:52:14 PM UTC, original submission:  

The Summary says it all. The same is true for interpn.

Please check out the attached file.
It illustrates the problem and includes a workaround.



Malte Hinrichs <maldje>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

Attached Files
file #32546:  test_interp2c.m added by maldje (1KiB - application/octet-stream - workaround with interpn)
file #32424:  test_interp2b.m added by maldje (827B - application/octet-stream - modified and bug fixed for matlab)
file #32273:  test_interp2.m added by maldje (708B - application/octet-stream - corrected example file)
file #32272:  test_interp2.m added by maldje (518B - application/octet-stream - test file for interp2)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by hardy (Posted a comment)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by maldje (Submitted the item)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.




    Follow 10 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-04-27 mtmiller Carbon-CopyRemoved 80942 => -
    2018-04-27 mtmiller Release3.8.0 => dev
        Operating SystemMac OS => Any
    2014-11-26 maldje Attached File- => Added test_interp2c.m, #32546
    2014-11-12 rik5 Item GroupIncorrect Result => Matlab Compatibility
        StatusNeed Info => Confirmed
    2014-11-12 maldje Attached File- => Added test_interp2b.m, #32424
    2014-11-05 rik5 StatusNone => Need Info
    2014-10-14 maldje Attached File- => Added test_interp2.m, #32273
    2014-10-14 maldje Attached File- => Added test_interp2.m, #32272

    Back to the top

    Powered by Savane 3.5