Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Proposal for multiplying a NumPy array by a scalar TransferFunction #1076

Closed
@sdahdah

Description

@sdahdah

Currently, multiplying a SISO TransferFunction object by a NumPy array results in a dimension error:

import control
import numpy as np

tf = control.TransferFunction([1], [1, 0])
arr = np.array([
    [1, 0],
    [2, 1],
])

print(tf * arr)
print(arr * tf)
ValueError: C = A * B: A has 1 column(s) (input(s)), but B has 2 row(s) (output(s)).

I think it would be convenient if output was a MIMO TransferFunction object of the array's dimension. So, for example,

G = control.TransferFunction(
    [
        [[1], [0]],
        [[2], [1]],
    ],
    [
        [[1, 0], [1, 0]],
        [[1, 0], [1, 0]],
    ],
)

I would be happy to implement this and do a PR, but I want to make sure it's something the maintainers actually want. I would think all SISO systems (state-space, etc) should behave in the same way.

This appears to have been discussed in #459 , but I'm not sure what the conclusion was.

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