octave-bug-tracker
[Top][All Lists]
Advanced

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

[Octave-bug-tracker] [bug #52673] fplot gives error for fplot(@(x) 0, [-


From: Rik
Subject: [Octave-bug-tracker] [bug #52673] fplot gives error for fplot(@(x) 0, [-2, 2])
Date: Fri, 15 Dec 2017 12:22:51 -0500 (EST)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:55.0) Gecko/20100101 Firefox/55.0

Update of bug #52673 (project octave):

                Priority:              5 - Normal => 3 - Low                
                  Status:               Confirmed => Fixed                  
             Open/Closed:                    Open => Closed                 

    _______________________________________________________

Follow-up Comment #2:

Matlab itself, I believe, used to be strict about requiring a vectorized
function.  At the bottom of their help they recommend, that for best
performance, the function be vectorized and use element-by-element operators. 


I've marked this as a low priority since the documentation states what the
expected input is.  Obvious workarounds are


fcn = @(x) 0 * x;
fcn = @(x) zeros (size (x));


which are both vectorized.

And as you also note, this happens to be a peculiarity of '0'.  There is
already code that handles a constant value function which is non-zero like
'5'.

It wasn't that hard to code a solution so I did that on the development branch
of Octave in this changeset
(http://hg.savannah.gnu.org/hgweb/octave/rev/3cd47be4fcbe).  Octave now warns,
as Matlab does, when the function is not vectorized but otherwise proceeds to
create the plot.  I also added BIST tests to catch this example.

Since this is just an m-file, you can grab the code from Mercurial to see the
fix.  Otherwise it will be part of the 4.4.0 release (no scheduled date for
this yet).


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?52673>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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