bugGNU Octave - Bugs: bug #51030, interp1 linear returns...

 
 

bug #51030: interp1 linear returns inconsistent results for all but first values in matrix

Submitted by:  None
Submitted on:  Mon 15 May 2017 05:40:54 PM UTC  
 
Category: Octave FunctionSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Incorrect Result
Status: FixedAssigned to: None
Originator Name: Niklas HambuechenOriginator Email: -unavailable-
Open/Closed: ClosedRelease: 4.2.1
Operating System: Any

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

Thu 18 May 2017 03:17:36 PM UTC, comment #3:

I pushed the patch to the stable branch of Octave here (http://hg.savannah.gnu.org/hgweb/octave/rev/22fd2ad85218). This will be a part of the bug fix release 4.2.2 if such a release occurs. Otherwise, it will be a part of the next major release 4.4.0. However, you can continue to just use the attached interp1.m as a workaround in a local installation. Closing report.

Rik <rik5>
Project Administrator
Mon 15 May 2017 11:03:18 PM UTC, comment #2:

Attached is both a patch, and the full interp1.m file. It can be tested by simply swapping in the new interp1.m file for the old one.

Rik <rik5>
Project Administrator
Mon 15 May 2017 09:18:37 PM UTC, comment #1:

Confirmed. And it is still present on the current stable version of Octave which is 4.2.1.

Rik <rik5>
Project Administrator
Mon 15 May 2017 05:40:54 PM UTC, original submission:

When running the following commands:

X = [120 60 0]'

v0 = [
[ 5.4410e+03 4.8674e+03 5.1208e+03 1.2981e+04 1.2407e+04 1.2661e+04 1.8651e+04 1.8077e+04 1.8331e+04]
[ 4.0110e+03 3.6304e+03 3.8449e+03 1.0423e+04 1.0043e+04 1.0257e+04 1.5951e+04 1.5570e+04 1.5785e+04]
[-3.0221e+02 -1.4564e+01 0.0000e+00 -3.0221e+02 -1.4564e+01 0.0000e+00 -3.0221e+02 -1.4564e+01 0.0000e+00]
]

x1 = -3.1623

interp1(X,v0,x1,'linear')

Octave 4.0.0 returns:

ans =

Columns 1 through 6:

NA -206.67 -202.65 -867.48 -544.65 -540.60

Columns 7 through 9:

-1158.84 -835.95 -831.95

Only the first value is NA, when they should all be NA.

When I run the same values (the first 2 columns) manually, they both return NA as expected:

interp1([120 60 0], [5.4410e+03 4.0110e+03 -3.0221e+02], -3.1623, 'linear')

ans = NA

interp1([120 60 0], [4.8674e+03 3.6304e+03 -1.4564e+01], -3.1623, 'linear')

ans = NA

Matlab returns the correct results as well:

>> X = [120 60 0]';
>> v0 = [

[ 5.4410e+03 4.8674e+03 5.1208e+03 1.2981e+04 1.2407e+04 1.2661e+04 1.8651e+04 1.8077e+04 1.8331e+04]
[ 4.0110e+03 3.6304e+03 3.8449e+03 1.0423e+04 1.0043e+04 1.0257e+04 1.5951e+04 1.5570e+04 1.5785e+04]
[-3.0221e+02 -1.4564e+01 0.0000e+00 -3.0221e+02 -1.4564e+01 0.0000e+00 -3.0221e+02 -1.4564e+01 0.0000e+00]
];

>> x1 = -3.1623;
>> interp1(X,v0,x1,'linear')


ans =

NaN NaN NaN NaN NaN NaN NaN NaN NaN

Anonymous

 

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

Attach File(s):
   
   
Comment:
   

Attached Files
file #40700:  interp1.cset added by rik5 (1KiB - application/octet-stream)
file #40701:  interp1.m added by rik5 (29KiB - text/x-matlab)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by rik5 (Posted a comment)
  • -unavailable- added by None (Submitted the item)
  •  

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

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 7 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Thu 18 May 2017 03:17:36 PM UTCrik5StatusPatch Submitted=>Fixed
      Open/ClosedOpen=>Closed
    Mon 15 May 2017 11:03:39 PM UTCrik5Attached File-=>Added interp1.cset, #40700
      Attached File-=>Added interp1.m, #40701
    Mon 15 May 2017 11:03:18 PM UTCrik5StatusConfirmed=>Patch Submitted
    Mon 15 May 2017 09:18:37 PM UTCrik5StatusNone=>Confirmed
      Release4.0.0=>4.2.1

    Back to the top


    Powered by Savane 3.1-cleanup1