[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Should interp1.m function allow jumps in X-values?
From: |
Ben Abbott |
Subject: |
Re: Should interp1.m function allow jumps in X-values? |
Date: |
Thu, 23 Aug 2012 08:16:30 -0400 |
On Aug 22, 2012, at 9:50 AM, Ben Abbott wrote:
>
> On Aug 22, 2012, at 9:29 AM, Michael D Godfrey wrote:
>
>> On 08/22/2012 08:33 AM, Ben Abbott wrote:
>>> The reason for the difference is subtle (and sorry for not pointing it out
>>> earlier). The sort() function does not change the order of the duplicate X
>>> values. Thus, the continuity condition is not switched from right to left.
>>> The flipup() function is used in interp1 to do that. Below I used the
>>> fliplr() to ensure the proper continuity.
>>>
>>> X = [ 2 1 3 2];
>>> Y = [ 9 1 3 10];
>>> % These are right-continuos (returns 10)
>>> y1 = interp1 (X, Y, 2)
>>> [~, n] = sort (X);
>>> y2 = interp1 (X(n), Y(n), 2)
>>> [~, n] = sort (X, "descend");
>>> y3 = interp1 (X(n), Y(n), 2)
>>> y4 = interp1 (X, Y, 2, "-right")
>>> % These are left-continuous (returns 9)
>>> [~, n] = sort (fliplr (X), "descend");
>>> y5 = interp1 (X(n), fliplr(Y)(n), 2)
>>> y6 = interp1 (X, Y, 2, "-left")
>>>
>>> Ben
>>>
>> Very good. I could have thought of that! So, that gets rid of an important
>> problem. And this adds a bit in favor of your addition of -right and -left,
>> or at least another point to be made clear in the documentation. This
>> is definitely a subtle point about sorting. Time to look up what Knuth
>> has to say about this.
>>
>> By the way, the current devel interp1.m does not do the flipr(). Did you
>> add that in your local patch?
>>
>> Michael
>
> I haven't pushed the patch that includes the flip part yet.
>
> It has beed posted to the bug-tracker.
>
> https://savannah.gnu.org/bugs/?36732
>
> See attachement #26413
>
> Ben
I pushed a changeset.
http://hg.savannah.gnu.org/hgweb/octave/rev/94d512d712e3
Please comment if there are any remaining concerns.
Ben
- Re: Should interp1.m function allow jumps in X-values?, (continued)
- Message not available
- Message not available
- Re: Should interp1.m function allow jumps in X-values?, Michael D Godfrey, 2012/08/21
- Re: Should interp1.m function allow jumps in X-values?, Ben Abbott, 2012/08/21
- Re: Should interp1.m function allow jumps in X-values?, Michael D Godfrey, 2012/08/21
- Re: Should interp1.m function allow jumps in X-values?, Ben Abbott, 2012/08/22
- Re: Should interp1.m function allow jumps in X-values?, Michael D Godfrey, 2012/08/22
- Re: Should interp1.m function allow jumps in X-values?, Ben Abbott, 2012/08/22
- Re: Should interp1.m function allow jumps in X-values?,
Ben Abbott <=
- Re: Should interp1.m function allow jumps in X-values?, Michael D Godfrey, 2012/08/23
- Re: Should interp1.m function allow jumps in X-values?, Martin Helm, 2012/08/21
- Re: Should interp1.m function allow jumps in X-values?, Juan Pablo Carbajal, 2012/08/21
- Re: Should interp1.m function allow jumps in X-values?, Ed Meyer, 2012/08/21
- Re: Should interp1.m function allow jumps in X-values?, Martin Helm, 2012/08/21