Skip to content

Inconsistent evaluation of tf/ss systems with pole at the origin #532

Closed
@murrayrm

Description

@murrayrm

Systems that have a pole at the origin return inconsistent values:

import control as ct
sys_tf = ct.tf([1], [1, 0])
sys_ss = ct.tf2ss(sys_tf)

sys_tf(0)        # returns (inf+0j) with divide by zero warning
sys_tf(0j)       # returns (inf+nanj) with divide by zero warning
sys_ss(0)        # LinAlgError: Singular matrix
sys_tf.dcgain()  # returns array(inf)
sys_ss.dcgain()  # returns array(nan)

I think all of these should return inf (or array(inf)).

If you have a pole and zero at the origin, you get nan or 1:

sys_tf = ct.tf([1, 0], [1, 0])
sys_ss = ct.tf2ss(sys_tf)

sys_tf(0)        # returns (nan+0j) with invalid value warning
sys_ss(0)        # returns (1+0j) [state space system is empty]
sys_tf.dcgain()  # returns array(nan)
sys_ss.dcgain()  # returns (1+0j) [state space system is empty]

I think all of these cases should produce nan.

I have a partial fix in a branch, but want to see what people think the "right" answer is before committing it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions