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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #51030] interp1 linear returns inconsistent re


From: anonymous
Subject: [Octave-bug-tracker] [bug #51030] interp1 linear returns inconsistent results for all but first values in matrix
Date: Mon, 15 May 2017 13:40:55 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/58.0.3029.81 Chrome/58.0.3029.81 Safari/537.36

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

                 Summary: interp1 linear returns inconsistent results for all
but first values in matrix
                 Project: GNU Octave
            Submitted by: None
            Submitted on: Mon 15 May 2017 05:40:54 PM UTC
                Category: Octave Function
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Incorrect Result
                  Status: None
             Assigned to: None
         Originator Name: Niklas Hambuechen
        Originator Email: address@hidden
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 4.0.0
        Operating System: Any

    _______________________________________________________

Details:

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





    _______________________________________________________

Reply to this item at:

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

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]