# Block Diagram Algebra¶

`control.``feedback`(sys1, sys2=1, sign=-1)

Feedback interconnection between two I/O systems.

Parameters: sys1: scalar, StateSpace, TransferFunction, FRD : The primary plant. sys2: scalar, StateSpace, TransferFunction, FRD : The feedback plant (often a feedback controller). sign: scalar : The sign of feedback. sign = -1 indicates negative feedback, and sign = 1 indicates positive feedback. sign is an optional argument; it assumes a value of -1 if not specified. out: StateSpace or TransferFunction : ValueError : if sys1 does not have as many inputs as sys2 has outputs, or if sys2 does not have as many inputs as sys1 has outputs NotImplementedError : if an attempt is made to perform a feedback on a MIMO TransferFunction object

`series`, `parallel`

Notes

This function is a wrapper for the feedback function in the StateSpace and TransferFunction classes. It calls TransferFunction.feedback if sys1 is a TransferFunction object, and StateSpace.feedback if sys1 is a StateSpace object. If sys1 is a scalar, then it is converted to sys2‘s type, and the corresponding feedback function is used. If sys1 and sys2 are both scalars, then TransferFunction.feedback is used.

`control.``negate`(sys)

Return the negative of a system.

Parameters: sys: StateSpace, TransferFunction or FRD : out: StateSpace or TransferFunction :

Notes

This function is a wrapper for the __neg__ function in the StateSpace and TransferFunction classes. The output type is the same as the input type.

If both systems have a defined timebase (dt = 0 for continuous time, dt > 0 for discrete time), then the timebase for both systems must match. If only one of the system has a timebase, the return timebase will be set to match it.

Examples

```>>> sys2 = negate(sys1) # Same as sys2 = -sys1.
```
`control.``parallel`(sys1, sys2)

Return the parallel connection sys1 + sys2.

Parameters: sys1: scalar, StateSpace, TransferFunction, or FRD : sys2: scalar, StateSpace, TransferFunction, or FRD : out: scalar, StateSpace, or TransferFunction : ValueError : if sys1 and sys2 do not have the same numbers of inputs and outputs

`series`, `feedback`

Notes

This function is a wrapper for the __add__ function in the StateSpace and TransferFunction classes. The output type is usually the type of sys1. If sys1 is a scalar, then the output type is the type of sys2.

If both systems have a defined timebase (dt = 0 for continuous time, dt > 0 for discrete time), then the timebase for both systems must match. If only one of the system has a timebase, the return timebase will be set to match it.

Examples

```>>> sys3 = parallel(sys1, sys2) # Same as sys3 = sys1 + sys2.
```
`control.``series`(sys1, sys2)

Return the series connection sys2 * sys1 for –> sys1 –> sys2 –>.

Parameters: sys1: scalar, StateSpace, TransferFunction, or FRD : sys2: scalar, StateSpace, TransferFunction, or FRD : out: scalar, StateSpace, or TransferFunction : ValueError : if sys2.inputs does not equal sys1.outputs if sys1.dt is not compatible with sys2.dt

`parallel`, `feedback`
```>>> sys3 = series(sys1, sys2) # Same as sys3 = sys2 * sys1.