Skip to content

Fix bug in matched transformation + address other issues in #950 - #951

Merged
murrayrm merged 3 commits into
python-control:mainfrom
murrayrm:matched_bug-26Dec2023
Dec 26, 2023
Merged

Fix bug in matched transformation + address other issues in #950#951
murrayrm merged 3 commits into
python-control:mainfrom
murrayrm:matched_bug-26Dec2023

Conversation

@murrayrm

Copy link
Copy Markdown
Member

This PR fixes the calculation of the DC gain in the 'matched' transformation from continuous time to discrete time. It also fixes some other issues identified in #950. Also adds unit test for sample_system that catches the original error.

@coveralls

coveralls commented Dec 26, 2023

Copy link
Copy Markdown

Coverage Status

coverage: 94.989% (-0.02%) from 95.009%
when pulling e4bcec0 on murrayrm:matched_bug-26Dec2023
into 7a8581c on python-control:main.

Comment thread control/xferfcn.py Outdated
murrayrm and others added 2 commits December 26, 2023 11:11
Co-authored-by: Sawyer Fuller <58706249+sawyerbfuller@users.noreply.github.com>
@murrayrm
murrayrm merged commit 177d8b6 into python-control:main Dec 26, 2023
@murrayrm
murrayrm deleted the matched_bug-26Dec2023 branch December 26, 2023 19:32
@murrayrm murrayrm added this to the 0.10.0 milestone Mar 31, 2024
gaoflow added a commit to gaoflow/python-control that referenced this pull request Aug 9, 2026
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 python-control#950/python-control#951.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

gain offset using control.matlab.c2d using method='matched' ?

3 participants