bugGNU Octave - Bugs: bug #38917, interp1 gives inconsistent results

 
 

bug #38917: interp1 gives inconsistent results

Submitter:  None
Submitted:  Tue 07 May 2013 05:17:57 AM UTC
   
 
Category:  Libraries Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Inaccurate Result
Status:  Fixed Assigned to:  None
Originator Name:  Ted12201 Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * 3.6.4
Operating System:  * Any Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Wed 19 Jun 2013 07:13:56 PM UTC, comment #1: 

Happily, this has already been fixed in the development code.  To access the fix you will need to build from development sources or wait until the next major release of Octave (3.8).

Rik <rik5>
Group administrator
Tue 07 May 2013 05:17:57 AM UTC, original submission:  

interp1(x,y,z) returns different results from MatLab and SciLab when both y and z are matrices. It appears that MatLab and SciLab results are correct.

For example,

x=1:30;
y=[x.^2; x.^0.5];
z=2:5;
X=X';
y=y';
z=z';
z=[z.^2 z.^0.5];
interp1(x,y,z)
interp1(x,y,z(:,1))
interp1(x,y,z(:,2))


Both Matlab and Scilab return

ans(:,:,1) =
   16.0000    2.2426
   81.0000    3.1962
  256.0000    4.0000
  625.0000    5.1803

ans(:,:,2) =
    2.0000    1.1716
    3.0000    1.3032
    4.0000    1.4142
    5.0000    1.4892

ans =
    16     2
    81     3
   256     4
   625     5

ans =
    2.2426    1.1716
    3.1962    1.3032
    4.0000    1.4142
    5.1803    1.4892

But Octave returns

ans(:,:,1) =
    16.0000     2.2426
    81.0000     1.0000
   256.0000     6.0711
   625.0000     4.0000

ans(:,:,2) =
   2.0000   1.3032
   3.0000   1.0978
   4.0000   1.6469
   5.0000   1.4892

ans =
    16     2
    81     3
   256     4
   625     5

ans =
   2.2426   1.1716
   3.1962   1.3032
   4.0000   1.4142
   5.1803   1.4892

These results suggest Octave is calculating correctly when a vector is given as z but not when it is a matrix.

Anonymous

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2013-06-19 rik5 StatusNone Fixed
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code