bugGNU Octave - Bugs: bug #42495, control package: bode does not...

 
 

bug #42495: control package: bode does not accept a scalar as w

Submitter:  None
Submitted:  Mon 02 Jun 2014 08:03:38 PM UTC
   
 
Category:  Octave Package Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  Fixed Assigned to:  None
Originator Name:  Thaeron Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * other
Operating System:  * Any Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Thu 11 Apr 2019 01:49:19 PM UTC, comment #6: 

sorry it is closed.

Doug Stewart <dastew>
Thu 11 Apr 2019 01:44:55 PM UTC, comment #5: 

I believe this can be closed as fixed.

Doug Stewart <dastew>
Sun 18 Oct 2015 04:49:04 PM UTC, comment #4: 

Thanks for your report and patience. I've just pushed a changeset:

https://bitbucket.org/paramaniac/control/commits/f1f2175c8ca54ff916f741c3e1793ac6cef79910

The fix will be part of the upcoming control package version 3.0.0

Lukas Reichlin <paramaniac>
Fri 19 Jun 2015 04:22:49 PM UTC, comment #3: 

I've done your test. That's the result :

>> sys = tf(1, [1 1]);
>> [mag, phase] = bode(sys);
>> size(mag), size(phase)


ans =

     1     1    55


ans =

     1     1    55

>> [mag, phase] = bode(sys, [0.1 1 10 100]);
>> size(mag), size(phase)


ans =

     1     1     4


ans =

     1     1     4

>> [mag, phase] = bode(sys, [1 1])


mag(:,:,1) =

    0.7071


mag(:,:,2) =

    0.7071


phase(:,:,1) =

   -45


phase(:,:,2) =

   -45

>> [mag, phase] = bode(sys, 1)


mag =

    0.7071


phase =

   -45

Anonymous
Fri 19 Jun 2015 02:00:14 PM UTC, comment #2: 

Still waiting for someone to run a provided example in Matlab, adding control package maintainer in cc in the meantime.

Mike Miller <mtmiller>
Group Member
Thu 15 Jan 2015 03:09:53 AM UTC, comment #1: 

Thanks for your bug report. I can't confirm, no access to Matlab's control toolbox at the moment, but what you describe seems reasonable based on a quick reading of http://www.mathworks.com/help/control/ref/bode.html. Namely, whether w is a vector or a scalar, bode should plot or return the evaluation of the system at the discrete frequencies in w.

If someone with access to the control toolbox can run a test, try


sys = tf(1, [1 1]);
[mag, phase] = bode(sys);
size(mag), size(phase)
[mag, phase] = bode(sys, [0.1 1 10 100]);
size(mag), size(phase)
[mag, phase] = bode(sys, [1 1])
[mag, phase] = bode(sys, 1)


Mike Miller <mtmiller>
Group Member
Mon 02 Jun 2014 08:03:38 PM UTC, original submission:  

I was porting matlab/mathscript code to octave and a "curious" thing happened :

[gain,phase]=bode(H, w);

gain and phase are vectors with lengths of 502. I was expecting vectors with lengths of 1 because it's the case of w parameter and the documentation says :

Function File: [mag, pha, w] = bode (sys, w)
mag
    Vector of magnitude. Has length of frequency vector w.
pha
    Vector of phase. Has length of frequency vector w.

Matlab and mathscript have the behavior that I was expecting.

So I digg a bit and see in _frequency_response_ (which is used by bode) :

w_idx = cellfun (@(x) is_real_vector (x) && length (x) > 1, args);  # look for frequency vectors

Does the "length(x) > 1" really necessary ? That breaks matlab compatibility (and it's not explicitly explained in the documentation)...

Anonymous

 

(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 dastew (Posted a comment)
  • -email is unavailable- added by paramaniac (Posted a comment)
  • -email is unavailable- added by mtmiller
  • -email is unavailable- added by None (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 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-04-11 mtmiller Carbon-CopyRemoved 80942 -
    2015-10-19 mtmiller StatusNeed Info Fixed
        Open/ClosedOpen Closed
    2015-06-19 mtmiller Carbon-Copy- Added paramaniac
    2015-06-19 mtmiller Release3.8.1 other
    2015-01-15 mtmiller StatusNone Need Info
        Summarycontrol : _frequency_response_ does not accept a scalar as w control package: bode does not accept a scalar as w

    Back to the top

    Powered by Savane 3.13-bb6a.
    Corresponding source code