bug #44002: The "extrap" option does not work in interp3 function.

 Submitter: None Submitted: Wed 14 Jan 2015 01:18:49 PM UTC Category: Octave Function Severity: 3 - Normal Priority: 5 - Normal Item Group: None Status: Fixed Assigned to: siko1056 Originator Name: Edwin de Koning Originator Email: -email is unavailable- Open/Closed:  * Closed Release:  * 3.8.2 Operating System:  * Any Fixed Release: None Planned Release: None
* Mandatory Fields

Add a New Comment Rich Markup

Discussion

Thu 05 Feb 2015 05:35:54 PM UTC, comment #3:

Finally I adapted the "extrap" behavior to MATLABs (see 5a59c0e1203d). Except for the "spline" method, one always has to provide a scalar numerical value for extrapolation.

Kai Torben Ohlhus <siko1056>
Thu 15 Jan 2015 02:42:44 PM UTC, comment #2:

It is not only a documentation error.
In Matlab, the default behavior is to extrapolate for values outside the range. Here is the Matlab result:

>> X=[0,0.5,1];Y=X;Z=X;
>> V=rand(3,3,3);
>> x=[-0.1,0,0.1]; y=x;z=x;
>> interp3(X,Y,Z,V,x,y,z,'spline')

ans =
0.2796    0.8147    0.8973

In Octave the last command would result in a NA for the first answer.

Anonymous
Thu 15 Jan 2015 12:19:26 PM UTC, comment #1:

Thank you for you bug report. It seems that "extrap" option should be a scalar value. That behavior is also consistent with MATLAB. It is clearly a documentation error and will be fixed with the next release.

So try:

interp3(X,Y,Z,V,x,y,z,"spline",0)

ans =

0.00000
0.33127
0.45983

Kai

Kai Torben Ohlhus <siko1056>
Wed 14 Jan 2015 01:18:49 PM UTC, original submission:

The interp3 function searches for values in a pre-defined list. It has an option to extrapolate the values outside of this list (this is actually the default Matlab behaviour). However, when this option is used, an error is given.

Example:

>> X=[0,0.5,1]; Y=X; Z=X;
>> V=rand(3,3,3);
>> x=[-0.1,0,0.1]; y=x; z=x;
>> interp3(X,Y,Z,V,x,y,z,"spline")

ans =

NA
0.26611
0.26838

(In this case, the default Octave behaviour is to return an "NA" for every outlier. However, I would like to extrapolate the values via the "extrap" option).

>> interp3(X,Y,Z,V,x,y,z,"spline","extrap")

error: interp3: wrong number or incorrectly formatted input arguments
error: called from:
error:   C:\Octave\Octave-3.8.2\share\octave\3.8.2\m\general\interp3.m a
t line 134, column 5

>>

Octave does not accept the "extrap" option in the interp3 function.

Anonymous

Attached Files

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

Comment:

No files currently attached

Dependencies

Depends on the following items: None found

Items that depend on this one: None found

Carbon-Copy List
• -email is unavailable- added by siko1056 (Posted a comment)
•

There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

Only group members can vote.