Skip to content

BUG: No dt in StateSpace operations #9913

@AndyLamperski

Description

@AndyLamperski

When adding or multiplying discrete-time StateSpace systems, the "dt" gets dropped, so that they become continuous time systems.

Reproducing code example:

M = np.ones((1,1))

P1 = sig.StateSpace(M,M,M,M,dt=1)
P2 = sig.StateSpace(M,M,M,M,dt=1)
P3 = P1 + P2
print(P1.dt,P2.dt,P3.dt)

This gives an output of

1 1 None

I think that all that is needed is to fix add the "dt" to the return statements of add, mul, and so on:

        return StateSpace(np.asarray(a, dtype=common_dtype),
                          np.asarray(b, dtype=common_dtype),
                          np.asarray(c, dtype=common_dtype),
                          np.asarray(d, dtype=common_dtype),
                          dt=self.dt)

However, I can't get the github scipy to compile correctly (due to #8325), so I have not tested this.

Scipy/Numpy/Python version information:

import sys, scipy, numpy; print(scipy.__version__, numpy.__version__, sys.version_info)
1.2.1 1.14.3 sys.version_info(major=3, minor=6, micro=8, releaselevel='final', serial=0)

Metadata

Metadata

Assignees

No one assigned

    Labels

    defectA clear bug or issue that prevents SciPy from being installed or used as expectedscipy.signal

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions