On Tue, Aug 21, 2012 at 2:22 PM, vivek dogra <
address@hidden> wrote:
>
>
> On Tue, Aug 21, 2012 at 5:51 PM, Martin Helm <
address@hidden> wrote:
>>
>> Am
21.08.2012 14:15, schrieb vivek dogra:
>> >
>> >
>> > By neither increasing nor decreasing, i meant if it is unsorted.
>> > example:
>> >
>> > X = [ 2 1 2 3];
>> > Y = [ 2 1 3 4];
>> >
>> This was already ruled out by Ben's answer that in such a case the
>> vector will be sorted! So the only case which was left is the constant
>> one.
>
>
> So it means whenever X is unsorted, interp1 will always give the
> "discontinuous interpolant" corresponding to increasing values of X. It
> means it is hard coded in the function that it will always sort X in
> increasing order. So, it is not symmetric. Why interp1 is favoring
> right-continuous?
>
> Now looking from the practical point of view let's say (because of some
> error) we have following data points:
> X = [ 1 2 2 3];
> Y = [ 1 2 10 4];
>
> In this case because X is increasing, interp1 will consider value of 2 as
> 10.
>
> which is of course incorrect.
> In this case it will be better for the user to do some pre-processing (as in
> whether to take the max., min., or the mean of 2 identical values)
>