[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: |
Tue, 21 Aug 2012 07:51:28 -0400 |
On Aug 21, 2012, at 7:42 AM, vivek dogra wrote:
> On Tue, Aug 21, 2012 at 4:34 PM, Ben Abbott <address@hidden> wrote:
>
>> On Aug 21, 2012, at 4:26 AM, vivek dogra wrote:
>>
>> > Hello,
>> > Currently, interp1.m allows at most one identical pair of values in X. My
>> > concern is should it really do that? My arguments are as follows:
>> >
>> > In my opinion repeated values should not be allowed for interpolation.
>> > Let's say i have following data points:
>> >
>> > x f(x)
>> > 0 4
>> > 1 6
>> > 2 8
>> > 3 10
>> >
>> > Now if i want to get f(1.5) then i will take the value midway between f(1)
>> > and f(2) which would be 7. Now in case i have repeated values the data
>> > points will be:
>> >
>> > x f(x)
>> > 0 4
>> > 1 6
>> > 1 7
>> > 2 8
>> > 3 10
>> >
>> > Now in this case what f(1.5) will be? 7 or 7.5? (What will you call the
>> > best interpolation?) There will be ambiguity in this case. Also in the
>> > present case the sample points are nicely behaving so there is not much
>> > difference between 7 and 7.5. Although in some cases (if let's say f(1) =
>> > 6 and f(1) = 9) there can be lot of difference between answers when we
>> > choose one data point over another.
>> > So Octave should not allow repeated x values.
>>
>> Is the ambiguity due to a lack of clarity of the documentation, or does
>> interp1() not work in a consistent manner?
>>
>> Ben
>
> If we go by the documentation, then interp1.m is doing fine (which in turn
> creates confusion as to how the interp1 works).
>
> "The discontinuous interpolant is right-continuous if @var{x} is increasing,
> left-continuous if it is decreasing."
>
> I am not able to digest this statement "if @var{x} is increasing or
> decreasing". Increasing with respect to what?
> And what will happen in case when X is neither increasing nor decreasing.
Increasing or descreasing with respect to X ... meaning is the original X
increasing or decreasing. If X is unsorted, then it will be sorted with
increasing values.
Ben
- Should interp1.m function allow jumps in X-values?, vivek dogra, 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?, vivek dogra, 2012/08/21
- Re: Should interp1.m function allow jumps in X-values?,
Ben Abbott <=
- Re: Should interp1.m function allow jumps in X-values?, vivek dogra, 2012/08/21
- Re: Should interp1.m function allow jumps in X-values?, vivek dogra, 2012/08/21
- 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?, vivek dogra, 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?, Juan Pablo Carbajal, 2012/08/21
- Re: Should interp1.m function allow jumps in X-values?, vivek dogra, 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?, vivek dogra, 2012/08/21
- Re: Should interp1.m function allow jumps in X-values?, Juan Pablo Carbajal, 2012/08/21