bugGNU Octave - Bugs: bug #31871, interp1 gives the wrong result for...

 
 

bug #31871: interp1 gives the wrong result for cubic interpolation

Submitter:  Ben Abbott <bpabbott>
Submitted:  Tue 14 Dec 2010 02:53:49 AM UTC
   
 
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  None
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * dev Operating System:  * Mac OS
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Sat 16 Apr 2011 03:01:08 PM UTC, comment #5: 

Yes, Thorsten fixed it with another changeset.

http://hg.savannah.gnu.org/hgweb/octave/rev/b3f9f98e7640

Ben Abbott <bpabbott>
Group Member
Sat 16 Apr 2011 11:18:43 AM UTC, comment #4: 

Ben,

this seems to work now.

octave:1> x = [1:4, 10];
octave:2> f = @(x) polyval ([0 1 1], x);
octave:3> interp1 (x, f(x), x, "cubic")
ans =

    2    3    4    5   11

octave:4> f(x)
ans =

    2    3    4    5   11

octave:5>

Can we close this bug?

Kai

Kai Habel <kahacjde>
Group Member
Thu 16 Dec 2010 03:46:28 PM UTC, comment #3: 

I"ve attached a patch. It includes a new test.

(file #22213)

Ben Abbott <bpabbott>
Group Member
Thu 16 Dec 2010 03:12:50 PM UTC, comment #2: 

We could do that. Would it make sense to fix the current method and use it for "v5cubic"?

I haven't gotten the details figured out, but it looks to me like only the 3rd order terms are wrong. Meaning for ...

    y = a*x.^3 + b*x.^2 + c*x + d

Is it the solution for "a" that has the bug.


Ben Abbott <bpabbott>
Group Member
Thu 16 Dec 2010 01:28:04 PM UTC, comment #1: 

I can confirm with 3.3.53. Why don't we set cubic equivalent to pchip (as in ml)?

Marco

Marco Caliari <caliari>
Group Member
Tue 14 Dec 2010 02:53:49 AM UTC, original submission:  

Simple example ...


x = [1:4, 10];
f = @(x) polyval ([0 1 1], x);
interp1 (x, f(x), x, "cubic")
ans =     2.0000     3.0000     4.0000     5.0000   291.0000
f(x)
ans =    2    3    4    5   11


I see the same result for 3.0.5 and the developer's sources.

Ben Abbott <bpabbott>
Group Member

 

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

Attach Files:
   
   
Comment:
   

Attached Files

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by kahacjde (Posted a comment)
  • -email is unavailable- added by caliari (Posted a comment)
  • -email is unavailable- added by bpabbott (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 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2011-04-16 bpabbott StatusReady For Test Fixed
        Open/ClosedOpen Closed
    2010-12-16 bpabbott Attached File- Added changeset.patch, #22213
        StatusNone Ready For Test

    Back to the top

    Powered by Savane 3.13-caa5.
    Corresponding source code