bugGNU Octave - Bugs: bug #62185, [Octave Forge] (Control) 'impulse'...


bug #62185: [Octave Forge] (Control) 'impulse' throws error for systems with nonzero feedthrough

Submitted by:  None
Submitted on:  Tue 15 Mar 2022 02:40:39 AM UTC
Category:  Octave Forge Package Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Ready For Test Assigned to:  None
Originator Name:  Chris Originator Email:  -email is unavailable-
Open/Closed:  * Open Release:  * 6.4.0
Operating System:  * Any
* Mandatory Fields

Add a New Comment (Rich Markup)

Comment Type & Canned Response:


Sun 20 Mar 2022 08:55:36 PM UTC, comment #4: 

This is great. Many thanks!

Sun 20 Mar 2022 08:54:24 PM UTC, comment #3: 

I have implemented your suggestion with commit https://sourceforge.net/p/octave/control/ci/23e4dd132cb9f92c22c9602375ff5fc608fbd485/ in the default branch. It will be part of the next major release of the control package.

Torsten Lilge <ttl>
Project Member
Thu 17 Mar 2022 09:22:53 PM UTC, comment #2: 

Thank you for your helpful explanation.

Perhaps it would be practical for Octave's impulse() to not bail in this sort of situation, but instead to behave as Matlab does and also emit a Warning about the necessity of doing this. This would prevent scripts from failing on Octave and yet working on Matlab. My full script fell over completely due to the behaviour of Octave's implemenation of impulse() in this case, whereas had it emitted a Warning it would have at least executed the rest of the commands (and I would have known about a possible issue with impulse() to pay attention to).

Tue 15 Mar 2022 08:17:14 PM UTC, comment #1: 

Thanks for the report.

The system from force to acceleration is as transfer function

Transfer function 'ans' from input 'Force' to output ...

                -s^2 - 1.57e-15 s - 3.14e-15
 Acceleration:  ----------------------------
                       s^2 + 1 s + 10

with a feedthrough of -1. With an impulse as input function, which is infinite at t = 0 in continuous time, the output value y(t=0) is also infinite at t = 0. That's why it does not make much sense to compute the (not realizable) impulse response.

The documentation of matlab says that it just ignores this "discontinuity" for systems with nonzero feedthrough and returns C*B at t = 0 instead (the part of y(0) without D*u(0)).

One might discuss whether to not compute the impulse response of such a system (as Octave does) or to show an incomplete response.

Torsten Lilge <ttl>
Project Member
Tue 15 Mar 2022 02:40:39 AM UTC, original submission:  

The function 'impulse' throws an error when computing the impulse response of a second order state-space model. Here is the relevant code:

% Initialization

m = 1.0     % Mass
k = 10.0    % Spring constant
b = 1      % Damping constant

% State-space model of the mass-spring-damper system

A = [0 1;...
     -k/m -b/m]

B = [0;...

C = [1 0;...
     0 1;...
     -k/m -b/m]

D = [0;

states = {'Position' 'Velocity'}
inputs = {'Force'}
outputs = {'Position' 'Velocity' 'Acceleration'}

system = ss(A,B,C,D,'statename',states,...
'inputname', inputs,...
'outputname', outputs)

% Time-domain responses

% Impulse responses




The third impulse response fails to produce an output and throws the following error:

error: Order numerator >= order denominator
error: called from
    imp_invar at line 95 column 5
    __c2d__ at line 65 column 16
    c2d at line 87 column 7
    __time_response__ at line 134 column 13
    impulse at line 79 column 13
    mass_spring_damper_ss_demo_01 at line 51 column 1

For reference, Matlab (version info below) is able to compute the same impulse response without crashing.

MATLAB Version: (R2021b) Prerelease
MATLAB License Number: 865865
Operating System: Microsoft Windows 10 Pro Version 10.0 (Build 19044)
Java Version: Java 1.8.0_202-b08 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode



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

Attach Files:

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 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 project members can vote.





    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2022-03-20 ttl StatusNone => Ready For Test
    2022-03-15 ttl Operating SystemMicrosoft Windows => Any
        SummaryFunction 'impulse' throws error for a certain simple 'ss' system => [Octave Forge] (Control) 'impulse' throws error for systems with nonzero feedthrough

    Back to the top

    Powered by Savane 3.9