LTI System Models¶
base
¶
Base classes for Linear Time-Invariant (LTI) systems.
LinearTimeInvariant
¶
Bases: ABC
Abstract base class representing a Linear Time-Invariant (LTI) system.
This class defines the common interface and properties for all LTI models, such as transfer functions and state-space models.
Source code in src/ctrlpy/models/base.py
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 | |
inputs
abstractmethod
property
¶
Number of inputs to the system.
Returns:
| Type | Description |
|---|---|
int
|
The number of input channels. |
outputs
abstractmethod
property
¶
Number of outputs from the system.
Returns:
| Type | Description |
|---|---|
int
|
The number of output channels. |
is_siso
property
¶
Whether the system is Single-Input Single-Output (SISO).
Returns:
| Type | Description |
|---|---|
bool
|
True if inputs == 1 and outputs == 1, False otherwise. |
is_discrete
property
¶
Whether the system is discrete-time (always False for continuous LTI).
Returns:
| Type | Description |
|---|---|
bool
|
False for continuous-time systems. |
c2d
¶
Discretize the continuous-time LTI system into a discrete-time TransferFunction.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dt
|
float
|
Sampling time Ts in seconds (must be strictly positive). |
required |
method
|
('zoh', 'foh', 'tustin', 'bilinear', 'prewarping', 'matched')
|
Discretization method, default is "zoh". |
"zoh"
|
prewarp_frequency
|
float | None
|
Pre-warping frequency in rad/s for Tustin pre-warping. |
None
|
w_warp
|
float | None
|
Alias for prewarp_frequency. |
None
|
Returns:
| Type | Description |
|---|---|
DiscreteTransferFunction
|
Discretized transfer function H(z). |
Source code in src/ctrlpy/models/base.py
to_discrete
¶
Alias for c2d(). Discretize the continuous-time LTI system.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dt
|
float
|
Sampling time Ts in seconds. |
required |
method
|
('zoh', 'foh', 'tustin', 'bilinear', 'prewarping', 'matched')
|
Discretization method, default is "zoh". |
"zoh"
|
prewarp_frequency
|
float | None
|
Pre-warping frequency in rad/s. |
None
|
w_warp
|
float | None
|
Alias for prewarp_frequency. |
None
|
Returns:
| Type | Description |
|---|---|
DiscreteTransferFunction
|
Discretized transfer function H(z). |
Source code in src/ctrlpy/models/base.py
poles
abstractmethod
¶
Compute the poles of the system.
Returns:
| Type | Description |
|---|---|
NDArray[complex128]
|
1D array of system poles. |
zeros
abstractmethod
¶
Compute the zeros of the system.
Returns:
| Type | Description |
|---|---|
NDArray[complex128]
|
1D array of system zeros. |
__add__
abstractmethod
¶
__radd__
abstractmethod
¶
__sub__
abstractmethod
¶
__rsub__
abstractmethod
¶
__mul__
abstractmethod
¶
__rmul__
abstractmethod
¶
__neg__
abstractmethod
¶
feedback
abstractmethod
¶
step
¶
Compute the step response of the system.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
T
|
Sequence[float] | NDArray[floating] | float | None
|
Time vector or duration. If None, automatically determined. |
None
|
X0
|
Sequence[float] | NDArray[floating] | None
|
Initial state vector (for StateSpace systems). |
None
|
input_index
|
int
|
Input channel index, default is 0. |
0
|
Returns:
| Type | Description |
|---|---|
TimeResponseData
|
Simulation response object. |
Source code in src/ctrlpy/models/base.py
impulse
¶
Compute the impulse response of the system.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
T
|
Sequence[float] | NDArray[floating] | float | None
|
Time vector or duration. If None, automatically determined. |
None
|
X0
|
Sequence[float] | NDArray[floating] | None
|
Initial state vector (for StateSpace systems). |
None
|
input_index
|
int
|
Input channel index, default is 0. |
0
|
Returns:
| Type | Description |
|---|---|
TimeResponseData
|
Simulation response object. |
Source code in src/ctrlpy/models/base.py
bode
¶
Compute the frequency response (Bode) data for the system.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
omega
|
Sequence[float] | NDArray[floating] | None
|
Frequency vector in rad/s. |
None
|
Returns:
| Type | Description |
|---|---|
BodeData
|
Bode response object. |
Source code in src/ctrlpy/models/base.py
nyquist
¶
Compute the Nyquist frequency response data for the system.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
omega
|
Sequence[float] | NDArray[floating] | None
|
Frequency vector in rad/s. |
None
|
Returns:
| Type | Description |
|---|---|
NyquistData
|
Nyquist response object. |
Source code in src/ctrlpy/models/base.py
margin
¶
Compute the stability margins of the system.
Returns:
| Type | Description |
|---|---|
StabilityMargins
|
Dataclass with GM, PM, Wcg, and Wcp. |
Source code in src/ctrlpy/models/base.py
root_locus
¶
Compute closed-loop root locus trajectories for varying gains.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
gains
|
Sequence[float] | NDArray[floating] | None
|
Gain values k >= 0. |
None
|
Returns:
| Type | Description |
|---|---|
RootLocusData
|
Root locus trajectory data. |
Source code in src/ctrlpy/models/base.py
plot_step
¶
Plot the step response using Matplotlib or Plotly.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
T
|
Sequence[float] | NDArray[floating] | float | None
|
Time vector or simulation duration. |
None
|
backend
|
('matplotlib', 'plotly')
|
Plotting backend, default is "matplotlib". |
"matplotlib"
|
ax
|
Axes | None
|
Existing Matplotlib Axes (for backend="matplotlib"). |
None
|
**kwargs
|
Any
|
Additional keyword arguments passed to the plotting routine. |
{}
|
Returns:
| Type | Description |
|---|---|
tuple[Figure, Axes] | Figure
|
Matplotlib (fig, ax) tuple or Plotly Figure. |
Source code in src/ctrlpy/models/base.py
iplot_step
¶
Plot interactive step response using Plotly.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
T
|
Sequence[float] | NDArray[floating] | float | None
|
Time vector or simulation duration. |
None
|
**kwargs
|
Any
|
Additional keyword arguments. |
{}
|
Returns:
| Type | Description |
|---|---|
Figure
|
Interactive Plotly Figure. |
Source code in src/ctrlpy/models/base.py
plot_impulse
¶
Plot the impulse response using Matplotlib or Plotly.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
T
|
Sequence[float] | NDArray[floating] | float | None
|
Time vector or simulation duration. |
None
|
backend
|
('matplotlib', 'plotly')
|
Plotting backend, default is "matplotlib". |
"matplotlib"
|
ax
|
Axes | None
|
Existing Matplotlib Axes (for backend="matplotlib"). |
None
|
**kwargs
|
Any
|
Additional keyword arguments passed to the plotting routine. |
{}
|
Returns:
| Type | Description |
|---|---|
tuple[Figure, Axes] | Figure
|
Matplotlib (fig, ax) tuple or Plotly Figure. |
Source code in src/ctrlpy/models/base.py
iplot_impulse
¶
Plot interactive impulse response using Plotly.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
T
|
Sequence[float] | NDArray[floating] | float | None
|
Time vector or simulation duration. |
None
|
**kwargs
|
Any
|
Additional keyword arguments. |
{}
|
Returns:
| Type | Description |
|---|---|
Figure
|
Interactive Plotly Figure. |
Source code in src/ctrlpy/models/base.py
plot_bode
¶
Plot Bode diagram using Matplotlib or Plotly.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
omega
|
Sequence[float] | NDArray[floating] | None
|
Frequency vector in rad/s. |
None
|
margins
|
bool
|
Whether to calculate and annotate stability margins, default is True. |
True
|
backend
|
('matplotlib', 'plotly')
|
Plotting backend, default is "matplotlib". |
"matplotlib"
|
ax
|
Sequence[Axes] | NDArray[Any] | None
|
Sequence of 2 Matplotlib Axes (for backend="matplotlib"). |
None
|
**kwargs
|
Any
|
Additional keyword arguments. |
{}
|
Returns:
| Type | Description |
|---|---|
tuple[Figure, tuple[Axes, Axes]] | Figure
|
Matplotlib (fig, (ax_mag, ax_phase)) or Plotly Figure. |
Source code in src/ctrlpy/models/base.py
iplot_bode
¶
Plot interactive Bode diagram using Plotly.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
omega
|
Sequence[float] | NDArray[floating] | None
|
Frequency vector in rad/s. |
None
|
margins
|
bool
|
Whether to calculate and annotate stability margins, default is True. |
True
|
**kwargs
|
Any
|
Additional keyword arguments. |
{}
|
Returns:
| Type | Description |
|---|---|
Figure
|
Interactive Plotly Figure. |
Source code in src/ctrlpy/models/base.py
plot_nyquist
¶
Plot Nyquist diagram using Matplotlib or Plotly.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
omega
|
Sequence[float] | NDArray[floating] | None
|
Frequency vector in rad/s. |
None
|
backend
|
('matplotlib', 'plotly')
|
Plotting backend, default is "matplotlib". |
"matplotlib"
|
ax
|
Axes | None
|
Matplotlib Axes (for backend="matplotlib"). |
None
|
**kwargs
|
Any
|
Additional keyword arguments. |
{}
|
Returns:
| Type | Description |
|---|---|
tuple[Figure, Axes] | Figure
|
Matplotlib (fig, ax) or Plotly Figure. |
Source code in src/ctrlpy/models/base.py
iplot_nyquist
¶
Plot interactive Nyquist diagram using Plotly.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
omega
|
Sequence[float] | NDArray[floating] | None
|
Frequency vector in rad/s. |
None
|
**kwargs
|
Any
|
Additional keyword arguments. |
{}
|
Returns:
| Type | Description |
|---|---|
Figure
|
Interactive Plotly Figure. |
Source code in src/ctrlpy/models/base.py
plot_root_locus
¶
Plot Root Locus diagram using Matplotlib or Plotly.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
gains
|
Sequence[float] | NDArray[floating] | None
|
Gain values k >= 0. |
None
|
backend
|
('matplotlib', 'plotly')
|
Plotting backend, default is "matplotlib". |
"matplotlib"
|
ax
|
Axes | None
|
Matplotlib Axes (for backend="matplotlib"). |
None
|
**kwargs
|
Any
|
Additional keyword arguments. |
{}
|
Returns:
| Type | Description |
|---|---|
tuple[Figure, Axes] | Figure
|
Matplotlib (fig, ax) or Plotly Figure. |
Source code in src/ctrlpy/models/base.py
iplot_root_locus
¶
Plot interactive Root Locus diagram using Plotly.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
gains
|
Sequence[float] | NDArray[floating] | None
|
Gain values k >= 0. |
None
|
**kwargs
|
Any
|
Additional keyword arguments. |
{}
|
Returns:
| Type | Description |
|---|---|
Figure
|
Interactive Plotly Figure. |
Source code in src/ctrlpy/models/base.py
transfer_function
¶
Transfer Function representation for Linear Time-Invariant (LTI) systems.
TransferFunction
¶
Bases: LinearTimeInvariant
Continuous-time Linear Time-Invariant Transfer Function representation.
Represents a rational polynomial transfer function in Laplace variable \(s\):
.. math::
G(s) = \frac{N(s)}{D(s)} = \frac{b_m s^m + b_{m-1} s^{m-1} + \cdots + b_1 s + b_0}{a_n s^n + a_{n-1} s^{n-1} + \cdots + a_1 s + a_0}
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
num
|
Sequence[float] | NDArray[floating] | float
|
Numerator polynomial coefficients \(N(s)\) in descending powers of \(s\). |
required |
den
|
Sequence[float] | NDArray[floating] | float
|
Denominator polynomial coefficients \(D(s)\) in descending powers of \(s\).
Defaults to |
(1.0,)
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If numerator or denominator is empty, or denominator is identically zero. |
Source code in src/ctrlpy/models/transfer_function.py
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 | |
poles
¶
Compute the poles of the transfer function.
Returns:
| Type | Description |
|---|---|
NDArray[complex128]
|
Array of pole locations in the complex s-plane. |
Source code in src/ctrlpy/models/transfer_function.py
zeros
¶
Compute the zeros of the transfer function.
Returns:
| Type | Description |
|---|---|
NDArray[complex128]
|
Array of zero locations in the complex s-plane. |
Source code in src/ctrlpy/models/transfer_function.py
to_ss
¶
Convert transfer function to StateSpace representation.
Returns:
| Type | Description |
|---|---|
StateSpace
|
Equivalent state-space model. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the transfer function is improper (degree of num > degree of den). |
Source code in src/ctrlpy/models/transfer_function.py
__add__
¶
Parallel interconnection (self + other).
Source code in src/ctrlpy/models/transfer_function.py
__radd__
¶
Parallel interconnection with left operand (other + self).
__neg__
¶
__pos__
¶
__sub__
¶
Subtract systems (self - other).
Source code in src/ctrlpy/models/transfer_function.py
__rsub__
¶
Subtract from other system (other - self).
Source code in src/ctrlpy/models/transfer_function.py
__mul__
¶
Series (cascade) interconnection (self * other).
Source code in src/ctrlpy/models/transfer_function.py
__rmul__
¶
Series (cascade) interconnection with left operand (other * self).
__truediv__
¶
Divide transfer functions (self / other).
Source code in src/ctrlpy/models/transfer_function.py
__rtruediv__
¶
Divide other by self (other / self).
Source code in src/ctrlpy/models/transfer_function.py
feedback
¶
Compute the closed-loop feedback interconnection.
T(s) = self / (1 - sign * self * other)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
other
|
TransferFunction | StateSpace | float | int
|
Feedback path transfer function or gain H(s), defaults to 1 (unity feedback). |
1
|
sign
|
int | float
|
Sign of feedback summation. Defaults to -1 for standard negative feedback. |
-1
|
Returns:
| Type | Description |
|---|---|
TransferFunction | StateSpace
|
Closed-loop system representation. |
Source code in src/ctrlpy/models/transfer_function.py
__repr__
¶
__str__
¶
Return a formatted string representing the rational function in 's'.
Source code in src/ctrlpy/models/transfer_function.py
state_space
¶
State-Space representation for Linear Time-Invariant (LTI) systems.
StateSpace
¶
Bases: LinearTimeInvariant
Continuous-time Linear Time-Invariant State-Space representation.
Represents dynamic systems in continuous-time state-space form:
.. math::
\begin{aligned}
\dot{x}(t) &= A x(t) + B u(t) \\
y(t) &= C x(t) + D u(t)
\end{aligned}
where \(x(t) \in \mathbb{R}^n\) is the state vector, \(u(t) \in \mathbb{R}^m\) is the input vector, and \(y(t) \in \mathbb{R}^p\) is the output vector.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
A
|
ArrayLike
|
State transition matrix \(A \in \mathbb{R}^{n \times n}\). |
required |
B
|
ArrayLike
|
Input matrix \(B \in \mathbb{R}^{n \times m}\). |
required |
C
|
ArrayLike
|
Output matrix \(C \in \mathbb{R}^{p \times n}\). |
required |
D
|
ArrayLike
|
Direct feedthrough matrix \(D \in \mathbb{R}^{p \times m}\). |
required |
Raises:
| Type | Description |
|---|---|
DimensionMismatchError
|
If matrix dimensions are incompatible. |
Source code in src/ctrlpy/models/state_space.py
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 | |
poles
¶
Compute the poles (eigenvalues of A) of the state-space system.
Returns:
| Type | Description |
|---|---|
NDArray[complex128]
|
1D array of system poles. |
Source code in src/ctrlpy/models/state_space.py
zeros
¶
Compute the zeros of the state-space system.
Returns:
| Type | Description |
|---|---|
NDArray[complex128]
|
1D array of system zeros. |
Raises:
| Type | Description |
|---|---|
NotImplementedError
|
If the system is not SISO. |
Source code in src/ctrlpy/models/state_space.py
to_tf
¶
Convert state-space model to TransferFunction representation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_index
|
int
|
Index of the input channel for multi-input systems, by default 0. |
0
|
output_index
|
int
|
Index of the output channel for multi-output systems, by default 0. |
0
|
Returns:
| Type | Description |
|---|---|
TransferFunction
|
Equivalent transfer function representation for the specified input/output channel. |
Raises:
| Type | Description |
|---|---|
IndexError
|
If input_index or output_index is out of range. |
Source code in src/ctrlpy/models/state_space.py
__add__
¶
Parallel interconnection of StateSpace systems (self + other).
Source code in src/ctrlpy/models/state_space.py
__radd__
¶
Parallel interconnection with left operand (other + self).
__neg__
¶
__pos__
¶
__sub__
¶
Subtract systems (self - other).
Source code in src/ctrlpy/models/state_space.py
__rsub__
¶
Subtract StateSpace system from other (other - self).
Source code in src/ctrlpy/models/state_space.py
__mul__
¶
Series (cascade) interconnection: u -> other -> self -> y.
Source code in src/ctrlpy/models/state_space.py
__rmul__
¶
Series (cascade) interconnection with left operand.
Source code in src/ctrlpy/models/state_space.py
feedback
¶
Compute the closed-loop feedback interconnection in state-space.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
other
|
StateSpace | TransferFunction | float | int | None
|
Feedback path system H, defaults to None (unity feedback identity gain). |
None
|
sign
|
int | float
|
Sign of feedback summation. Defaults to -1 for standard negative feedback. |
-1
|
Returns:
| Type | Description |
|---|---|
StateSpace
|
Closed-loop state-space system. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If matrix dimensions are incompatible or if (I - signD1D2) is singular. |
Source code in src/ctrlpy/models/state_space.py
416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 | |
__repr__
¶
Return a string representation of the StateSpace object.
Source code in src/ctrlpy/models/state_space.py
__str__
¶
Return a formatted string representing the state-space matrices.