[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Interp1() usability bug
From: |
fork |
Subject: |
Interp1() usability bug |
Date: |
Thu, 27 Jan 2011 21:12:31 +0000 (UTC) |
User-agent: |
Loom/3.14 (http://gmane.org/) |
(I am not sure if this is worth a bug report, or what the ML behavior is, but it
might be worth considering.)
(1) interp1 will quietly allow different lengths for x and y inputs. This is
alright, I guess, but shouldn't we throw a warning at least? For example
14> interp1((0:5), 2*(0:5), 4.5)
ans = 9
15> interp1((0:6), 2*(0:5), 4.5)
ans = 9
16> interp1((0:5), 2*(0:6), 4.5)
ans = 9
(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() usability bug,
fork <=