Cannot `ezplot` a constant: XX(0): subscripts must be either integers
I'm using GNU Octave to do some Signals and Systems experiments. In my textbook,
ezplotis used to draw symbols likeexp(2 * abs(t)). And to prove some properties, we need to substract two symbols and draw it to see if the difference is 0.
A quick poc:
pkg load symbolic;
syms a;
ezplot(a + a); % (sym)2a, success
ezplot(a - a); % (sym)0, failed
which throws:
error: XX(0): subscripts must be either integers 1 to (2^63)-1 or logicals
error: called from
__ezplot__>find_valid_domain at line 508 column 12
__ezplot__ at line 396 column 18
ezplot at line 84 column 21
ezplot at line 127 column 5
However, I expect it could draw a straight horizontal line to indicate the result is 0.
Confirmed, I get the same with ezplot(sym(2)) so probably this is something about determining the default symbol to plot against...
It appears to be an Octave bug:
f = @(t) 2*t + 3
g = @(t) 2
ezplot(f) % ok
ezplot(g) % error
error: XX(0): subscripts must be either integers 1 to (2^63)-1 or logicals
error: called from
__ezplot__>find_valid_domain at line 508 column 12
__ezplot__ at line 396 column 18
ezplot at line 84 column 21
https://savannah.gnu.org/bugs/?func=detailitem&item_id=49766
So it seems this was found years ago but we only fixed half of the bug! Thanks for uncovering this (again!)
I've filed a new upstream issue, you can track the progress there; once fixed, this should "just work" in Symbolic.
https://savannah.gnu.org/bugs/index.php?66563