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

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

[Octave-bug-tracker] [bug #38917] interp1 gives inconsistent results


From: anonymous
Subject: [Octave-bug-tracker] [bug #38917] interp1 gives inconsistent results
Date: Tue, 07 May 2013 05:17:59 +0000
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_5) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.65 Safari/537.31

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

                 Summary: interp1 gives inconsistent results
                 Project: GNU Octave
            Submitted by: None
            Submitted on: 2013年05月07日 05時17分57秒
                Category: Libraries
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Inaccurate Result
                  Status: None
             Assigned to: None
         Originator Name: Ted12201
        Originator Email: address@hidden
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 3.6.4
        Operating System: Any

    _______________________________________________________

Details:

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.





    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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