bugGNU Octave - Bugs: bug #52673, fplot gives error for fplot(@(x)...

 
 

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

Submitted by:  None
Submitted on:  Fri 15 Dec 2017 11:38:05 AM UTC  
 
Category: Octave FunctionSeverity: 3 - Normal
Priority: 3 - LowItem Group: Matlab Compatibility
Status: FixedAssigned to: None
Originator Name: omerOriginator Email: -unavailable-
Open/Closed: ClosedRelease: 4.2.1
Operating System: Any

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Fri 15 Dec 2017 05:22:50 PM UTC, 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

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).

Rik <rik5>
Project Administrator
Fri 15 Dec 2017 12:46:57 PM UTC, comment #1:

Thank you for your report. Please consider the programming notes of fplot:

https://www.gnu.org/software/octave/doc/interpreter/XREFfplot

So in general the function fplot was called with an improper function.

Matlab R2017b also throws a bunch of warnings before finally generating the desired plot.

Thus I declare this item as Matlab compatibility problem.

Kai Torben Ohlhus <siko1056>
Project Member
Fri 15 Dec 2017 11:38:05 AM UTC, original submission:

fplot function gives error for the function handler that returns constant 0. The problem is not occur with different constants.

The fplot is okey with the

Anonymous

 

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

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 6 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Fri 15 Dec 2017 05:22:50 PM UTCrik5Priority5 - Normal=>3 - Low
      StatusConfirmed=>Fixed
      Open/ClosedOpen=>Closed
    Fri 15 Dec 2017 12:46:57 PM UTCsiko1056Item GroupUnexpected Error=>Matlab Compatibility
      StatusNone=>Confirmed
      Operating SystemMicrosoft Windows=>Any

    Back to the top


    Powered by Savane 3.1-cleanup1