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

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

Add a New Comment Rich Markup
   

Jump to the original submission

Sun 14 Jan 2024 11:53:49 AM UTC, comment #8: 

For sgrid and zgrid, I am fine with switching the box on automatically and added this with commit https://github.com/gnu-octave/pkg-control/commit/acafb6dcfb827f9612f0edfa3cf8cca0e00034ad

For the grid, I would like to stick with enabled grids by default in step, impulse and other time responses as I think that a grid is always useful here. Moreover, I personally don't think that graphical output has to look necessarily the same way as the one of Matlab.

Closing this report.

Torsten Lilge <ttl>
Group Member
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>
Group 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>
Group 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>
Group 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 ttl (Posted a comment)
  • -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)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 8 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2024-01-14 ttl StatusConfirmed Fixed
        Open/ClosedOpen Closed
    2021-07-24 siko1056 Summary[package control] Matlab Compatibility for step() and axes &quot;grid&quot; property, sgrid() and axes &quot;box&quot; 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 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.13-f8d8.
    Corresponding source code