bugGNU Octave - Bugs: bug #40825, interp1 "linear" fails...

 
 

bug #40825: interp1 "linear" fails when x has jumps and y is multi-column

Submitted by:  Juan Pablo Carbajal <juanpi>
Submitted on:  Fri 06 Dec 2013 02:07:33 PM UTC  
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  None
Originator Name:  juanpi Open/Closed:  Closed
Release:  dev Operating System:  Any

Add a New Comment (Rich Markup)
   

You are not logged in

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

 

( Jump to the original submission)

Mon 14 Jul 2014 02:58:12 AM UTC, comment #6: 

This seems to match the documentation.  For the value exactly at 0.2, the interpolated value is right-continuous because the specified X are increasing.  Thus, the value is 0.  You can switch it by supplying "left" as the final argument in which case the interpolated value will be 1.

Rik <rik5>
Project Administrator
Sun 13 Jul 2014 05:25:12 PM UTC, comment #5: 

Using the developer's default branch

m = interp1([0;0.2;0.2;1], [1;1;0;0], [0.00000 0.19805 0.20000 0.20195 1.00000])
m =

   1   1   0   0   0

Is this correct behavior?

Ben Abbott <bpabbott>
Project Member
Sun 13 Jul 2014 03:26:23 PM UTC, comment #4: 

Hi

I've reported a regression in interp1 (bug #42763) which appears to have been caused by a patch that references this bug.

Regards
Robert

Anonymous
Fri 31 Jan 2014 06:37:25 PM UTC, comment #3: 

I applied your patch to the stable branch (http://hg.savannah.gnu.org/hgweb/octave/rev/b06675ef40f2).  I also updated a bunch of the documentation and verification tests (http://hg.savannah.gnu.org/hgweb/octave/rev/71d1a1450365).  Closing report.

Rik <rik5>
Project Administrator
Fri 06 Dec 2013 02:17:40 PM UTC, comment #2: 

oops, the patch is incomplete
here amended version.
Sorry

(file #29794)

Juan Pablo Carbajal <juanpi>
Project Member
Fri 06 Dec 2013 02:10:36 PM UTC, comment #1: 

A potential patch, please revise.

(file #29793)

Juan Pablo Carbajal <juanpi>
Project Member
Fri 06 Dec 2013 02:07:33 PM UTC, original submission:  

Hi,

This is somehow related with this bug
https://savannah.gnu.org/bugs/?func=detailitem&item_id=36732

The problem arises when interp1 fixes the input data due to jumps but mkpp doesn't know about it.

Example

t  = [0 1 1 2 3]';
x  = t;
ti = [0.5 1.5 2.5]';
interp1(t,x,ti); # works fine (reshape in mkpp line 78 is valid)
interp1(t,[x x],ti); # fails cause length is not multiple of szy(2) (line 252 in interp1)

The removal of jumps in lines 246-250 of interp1.m has to be consistent with multi-column inputs.

In the next post I will attach a change that may solve the problem. I am copying the data vector y cause I do not know if forward in the future it is used, I just followed the same policy as for x (copied to xx)

Juan Pablo Carbajal <juanpi>
Project Member

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #29794:  interp1.patch added by juanpi (1KiB - text/x-patch - amended patch)
file #29793:  interp1.patch added by juanpi (1KiB - text/x-patch - path for interp1 when jumps in multicolumn input)

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

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

    Only project members can vote.

     

     

     

    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2014-01-31 rik5 StatusNone => Fixed
        Open/ClosedOpen => Closed
    2014-01-30 rik5 Carbon-Copy- => Added bpabbott
    2013-12-06 juanpi Attached File- => Added interp1.patch, #29794
    2013-12-06 juanpi Attached File- => Added interp1.patch, #29793

    Back to the top


    Powered by Savane 3.5