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

 
 

bug #55244: [octave forge] (control) error from mag2db(...) within bode(...) when using minreal on the input transfer function

Submitter:  None
Submitted:  Wed 19 Dec 2018 03:05:36 PM UTC
   
 
Category:  Octave Package Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Unexpected Error or Warning
Status:  Confirmed Assigned to:  None
Originator Name:  Originator Email:  -email is unavailable-
Open/Closed:  * Open Release:  * 4.4.1
Operating System:  * GNU/Linux Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Sun 04 Jul 2021 08:35:01 PM UTC, comment #5: 

It seems that there is no error message with newer versions but the magintude at the resonance frequency w0 is much too small and the phase is NaN for following frequencies.

The complex frequency response at w0 is NaN + Inf*i. What could be a fix here? Maybe we can just set the denominator to a very small value, possibly depending on 'realmax', whenever it is exactly 0.

Torsten Lilge <ttl>
Group Member
Wed 19 Dec 2018 10:03:32 PM UTC, comment #4: 

The problem is that there is an Inf passed to mag2db.
and then we want to take the log of that.
By changing the input a small amount then we don't get the Inf.
because we don't evaluate the function exactly on a pole.

Doug Stewart <dastew>
Wed 19 Dec 2018 08:26:36 PM UTC, comment #3: 

Or a simpler way to reproduce:


s = tf ('s');
sys = s / (s^2 + 6.447453255964e6);
bode (sys)


Note that just removing one digit from the above makes it work:


sys = s / (s^2 + 6.44745325596e6);
bode (sys)


Mike Miller <mtmiller>
Group Member
Wed 19 Dec 2018 06:33:20 PM UTC, comment #2: 

This bug is confirmed for me with Octave 4.4.1 and control 3.1.0:


pkg load control
Lf = 330e-6;
Cf = 470e-6;
s = tf ('s');
Z0min = minreal (s * Cf / (1 + s^2 * Lf * Cf))
bode (Z0min)


The full error (original post is missing the last line):


error: Invalid call to mag2db.  Correct usage is:

 -- Function File: DB = mag2db (MAG)
error: called from
    print_usage at line 91 column 5
    mag2db at line 44 column 5
    bode at line 73 column 12


Mike Miller <mtmiller>
Group Member
Wed 19 Dec 2018 05:00:49 PM UTC, comment #1: 

I tried your code and it works for me
octave version 4.4.1
and control 3.1.0



Transfer function 'Z0min' from input 'u1' to output ...

          3030 s
 y1:  ---------------
      s^2 + 6.447e+06

Continuous-time model.

Transfer function 'Z0' from input 'u1' to output ...

          0.00047 s
 y1:  -----------------
      1.551e-07 s^2 + 1

Continuous-time model.

Transfer function 'Z0tf' from input 'u1' to output ...

          0.00047 s
 y1:  -----------------
      1.551e-07 s^2 + 1

Continuous-time model.

Doug Stewart <dastew>
Wed 19 Dec 2018 03:05:36 PM UTC, original submission:  

I receive an error with the following code and feel it might be a bug.


pkg load control
pkg load signal
Lf = 330e-6;
Cf = 470e-6;
s = tf('s');
Z0min = minreal(s*Cf/(1+s^2*Lf*Cf))
Z0 = s*Cf/(1+s^2*Lf*Cf)
Z0tf = tf([Cf,0],[Lf*Cf,0,1])


The three Z0 transfer functions should be equivalent but when I call bode(Z0min), I get the following error:


error: Invalid call to mag2db.  Correct usage is:

 -- Function File: DB = mag2db (MAG)
error: called from
    print_usage at line 90 column 5
    mag2db at line 44 column 5


The version info is as follows:

GNU Octave Version: 4.0.0
GNU Octave License: GNU General Public License
Operating System: Linux 4.4.0-139-generic #165-Ubuntu SMP Wed Oct 24 10:58:50 UTC 2018 x86_64
----------------------------------------------------------------------
Package Name  | Version | Installation directory
--------------+---------+-----------------------
     control *|   3.1.0 | /home/octave/control-3.1.0
      signal *|   1.4.0 | /home/octave/signal-1.4.0
    symbolic  |   2.7.1 | /home/octave/symbolic-2.7.1


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 ttl (Posted a comment)
  • -email is unavailable- added by dastew (Posted a comment)
  •  

    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 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-12-19 mtmiller StatusNone Confirmed
        Release4.0.0 4.4.1
        Summaryerror from mag2db(...) within bode(...) when using minreal on the input transfer function [octave forge] (control) error from mag2db(...) within bode(...) when using minreal on the input transfer function
    2018-12-19 rik5 Carbon-CopyRemoved 72865 -
    2018-12-19 rik5 CategoryOctave Function Octave Package

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code