[Top][All Lists]

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

[Octave-bug-tracker] [bug #56636] Octave's interp1 does not have the sam

From: Richard
Subject: [Octave-bug-tracker] [bug #56636] Octave's interp1 does not have the same rules for when to extrapolate as Matlab.
Date: Mon, 15 Jul 2019 18:10:02 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:67.0) Gecko/20100101 Firefox/67.0


                 Summary: Octave's interp1 does not have the same rules for
when to extrapolate as Matlab.
                 Project: GNU Octave
            Submitted by: crobar
            Submitted on: Mon 15 Jul 2019 10:10:00 PM UTC
                Category: Octave Function
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: WTF, Matlab?!?
                  Status: None
             Assigned to: None
         Originator Name: Richard Crozier
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 5.1.0
        Operating System: Any



This has sort of been reported in bug #42686, but that bug is closed.

The rules for when interp1 performs extrapolation, rather than returning a Nan
outside the domain differ for Octave and Matlab.

In Matlab for example:

x = linspace (0, 10, 100);
y = x .* 10;

yq = interp1 (x, y, 11, 'spline')

yq =


In Octave this returns nan. 

The Octave docs state "If extrap is the string "extrap", then extrapolate
values beyond the endpoints using the current method. If extrap is a number,
then replace values beyond the endpoints with that number. When unspecified,
extrap defaults to NA. "

This differs for Matlab, where for the 'pchip', 'spline', or 'makima'
interpolation methods, then the default behaviour is 'extrap', but otherwise
the behaviour is the same as Octave where the default is nan, unless extrap is
specified explicitly.

Personally I prefer the Octave way and think silently extrapolating without
warning the user, or the user asking for it, and having different defaults
depending on the extrapolation method is a bit mad, but it is definitely an


Reply to this item at:


  Message sent via Savannah

reply via email to

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