octave-maintainers
[Top][All Lists]
Advanced

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

Re: Should interp1.m function allow jumps in X-values?


From: vivek dogra
Subject: Re: Should interp1.m function allow jumps in X-values?
Date: Tue, 21 Aug 2012 17:12:05 +0530



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. 

 


reply via email to

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