Commit 3bca02b
committed
Fix matched c2d NaN for a pole or zero at the origin
TransferFunction.sample(Ts, method='matched') (and c2d) returned an
all-NaN numerator for any system with a pole or zero at s = 0 -
integrators, PI/PID controllers, differentiators and other type-1/2
systems. The DC-gain match divides the continuous DC gain (inf for an
origin pole, 0 for an origin zero) by a zgain that carries the same
vanishing 1 - z factor, so the gain is 0/0 or inf/inf.
Match the gain from the non-origin factors only and restore the origin
scaling analytically through the z - 1 ~ s*Ts limit, which recovers the
textbook Ts/(z - 1) for 1/s, Ts**2/(z - 1)**2 for 1/s**2, and so on.
Finite-DC systems are byte-for-byte unchanged. Completes the gain fix
from #950/#951.1 parent 7d5019e commit 3bca02b
2 files changed
Lines changed: 63 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
561 | 561 | | |
562 | 562 | | |
563 | 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 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1334 | 1334 | | |
1335 | 1335 | | |
1336 | 1336 | | |
1337 | | - | |
| 1337 | + | |
1338 | 1338 | | |
1339 | 1339 | | |
1340 | | - | |
1341 | | - | |
| 1340 | + | |
| 1341 | + | |
| 1342 | + | |
| 1343 | + | |
| 1344 | + | |
| 1345 | + | |
| 1346 | + | |
| 1347 | + | |
| 1348 | + | |
1342 | 1349 | | |
1343 | | - | |
1344 | | - | |
1345 | | - | |
1346 | | - | |
| 1350 | + | |
| 1351 | + | |
| 1352 | + | |
| 1353 | + | |
| 1354 | + | |
| 1355 | + | |
1347 | 1356 | | |
1348 | | - | |
1349 | | - | |
1350 | | - | |
1351 | | - | |
1352 | | - | |
1353 | | - | |
| 1357 | + | |
| 1358 | + | |
| 1359 | + | |
| 1360 | + | |
| 1361 | + | |
| 1362 | + | |
| 1363 | + | |
| 1364 | + | |
| 1365 | + | |
| 1366 | + | |
| 1367 | + | |
| 1368 | + | |
| 1369 | + | |
| 1370 | + | |
1354 | 1371 | | |
1355 | 1372 | | |
1356 | 1373 | | |
| |||
0 commit comments