|
From: | Michael Godfrey |
Subject: | Re: Interp1() usability bug |
Date: | Thu, 27 Jan 2011 13:22:26 -0800 |
User-agent: | Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101209 Fedora/3.1.7-0.35.b3pre.fc14 Thunderbird/3.1.7 |
On 01/27/2011 01:12 PM, fork wrote:
matlab R2009a says:(2) This behavior becomes a problem when we try to extrapolate, giving us an unexplained error from inside the file. The first three lines below are expected, but the last is funky. 19> interp1((0:10), 2*(0:10), 4.5) ans = 9 20> interp1((0:10), 2*(0:10), 11) ans = NA 21> interp1((0:10), 2*(0:10), 11, 'extrap') ans = 22 22> interp1((0:10), 2*(0:9), 11, 'extrap') error: A(I): Index exceeds matrix dimension. error: called from: error: C:\Octave\3.2.4_gcc-4.4.0\share\octave\3.2.4\m\general\interp1.m at line 208, column 19 If we checked for length(x) == length(y) and errored out if not, we could avoid this. Otherwise, shouldn't we at least give a slightly informative error, rather than just letting the malfunctioning indexing break it for us? I can file a bug tonight if its worth it. >> interp1((0:10), 2*(0:10), 4.5) ans = 9 >> interp1((0:10), 2*(0:10), 11) ans = NaN >> interp1((0:10), 2*(0:10), 11, 'extrap') ??? Error using ==> interp1 at 344 Invalid method. >> interp1((0:10), 2*(0:9), 11, 'extrap') ??? Error using ==> interp1 at 344 Invalid method. >> ==================== Maybe not try for strict compatibility?? Michael |
[Prev in Thread] | Current Thread | [Next in Thread] |