bugGNU Octave - Bugs: bug #60963, [octave forge] (control) Matlab...

 
 

bug #60963: [octave forge] (control) Matlab Compatibility for step() and axes "grid" property, sgrid() and axes "box" property

Submitted by:  sylvain bougnoux <sbougnoux>
Submitted on:  Fri 23 Jul 2021 02:17:21 PM UTC  
 
Category:  Octave Forge Package Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  Confirmed Assigned to:  None
Originator Name:  Open/Closed:  Open
Release:  6.3.0 Operating System:  Any

Add a New Comment (Rich Markup)
   

You are not logged in

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

 

( Jump to the original submission)

Mon 26 Jul 2021 09:31:17 AM UTC, comment #7: 

Thanks for all your answers,

Of course I can change my code, and I knew how to do it. But my point was FYI. Often I receive others code (written for matlab), which takes time to adapt, without speaking of the many examples around made for matlab.

Hence my question, do you try to be as close as possible to matlab or not ?

I guess it is hard to change now the default behavior of 'step' or 'sgrid' ; but maybe you can propose a flag such as 'matlab compatible' ?

sylvain bougnoux <sbougnoux>
Fri 23 Jul 2021 09:47:00 PM UTC, comment #6: 

It appears that Matlab made slightly different choices certain axes properties.  The maintainer for the control package might be convinced to change these.

For the step() function, Matlab does not set the axes "grid" property to "on".

For the sgrid() function, Matlab sets the axes "box" property to "on".

Rik <rik5>
Project Administrator
Fri 23 Jul 2021 09:30:08 PM UTC, comment #5: 

sys = tf([0 1],[1 1 100]);
figure(1),step(sys), grid

Try `help grid`.  When `grid` is given alone as a command it toggles the grid from "on" to "off" or from "off" to "on".

By default, the `step` function turns the grid on so your next command to grid turns it back off.  Apparently Matlab takes the opposite approach and the `step` function there does not turn the grid on so your next command actually shows the grid.  If you want to turn the grid on, rather than toggle it, then use the syntax

grid ('on');

This will make the code work regardless of whether you are running it in Octave or Matlab.

Rik <rik5>
Project Administrator
Fri 23 Jul 2021 02:45:52 PM UTC, comment #4: 

for 'hold' it's like:

figure
hold

plot([1,2],[1,2])
plot([1,2],[0,0])

sgrid, axis('equal')
hold

The axis is not drawn properly (incomplete), it lacks upper & rightmost limits.

sylvain bougnoux <sbougnoux>
Fri 23 Jul 2021 02:36:38 PM UTC, comment #3: 

Ok

figure(1), plot([1,2],[1,2]), grid

does show the grid, while:

sys = tf([0 1],[1 1 100]);
figure(1),step(sys), grid

does not.
I guess my title is wrong.

sylvain bougnoux <sbougnoux>
Fri 23 Jul 2021 02:26:44 PM UTC, comment #2: 

commentaire #1 :

> Can you please show what you mean?
>
> What sequence of function calls are you executing and what results do you expect?

sylvain bougnoux <sbougnoux>
Fri 23 Jul 2021 02:20:13 PM UTC, comment #1: 

Can you please show what you mean?

What sequence of function calls are you executing and what results do you expect?

John W. Eaton <jwe>
Project Administrator
Fri 23 Jul 2021 02:17:21 PM UTC, original submission:  

It seems that for matlab it is 'off' by default, and for octave it is the opposite. I guess it is 'difficult' to change, but it may apear in the documentation.

I found at least these 2 functions.
Sorry if it is well known.

sylvain bougnoux <sbougnoux>

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by siko1056 (Updated the item)
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by sbougnoux (Submitted the item)
  •  

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

    Only project members can vote.

     

     

     

    Follow 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2021-07-24 siko1056 Summary[package control] Matlab Compatibility for step() and axes "grid" property, sgrid() and axes "box" property => [octave forge] (control) Matlab Compatibility for step() and axes "grid" property, sgrid() and axes "box" property
    2021-07-23 rik5 Carbon-CopyRemoved 72865 => -
    2021-07-23 rik5 CategoryPlotting => Octave Forge Package
        StatusNone => Confirmed
        Operating SystemMicrosoft Windows => Any
        Summarydefault inconsistencies with matlab with 'grid' and 'hold' => [package control] Matlab Compatibility for step() and axes "grid" property, sgrid() and axes "box" property

    Back to the top


    Powered by Savane 3.6