Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
JonHowMIT opened this issue Dec 24, 2023 · 3 comments · Fixed by #951
Closed

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

JonHowMIT opened this issue Dec 24, 2023 · 3 comments · Fixed by #951
Assignees

Comments

@JonHowMIT
Copy link

Compared results of
sysc = ct.TransferFunction([1, z], [1, p])
sysd = ct.matlab.c2d(sysc, Ts, method='bilinear')
sysd1 = ct.matlab.c2d(sysc, Ts, method='matched')

yields a sysd1 with a gain that is about 10x that of sysd - is that expected?

@sawyerbfuller
Copy link
Contributor

Hi John great to hear from you and happy holidays. Glad to see you are using or at the very least evaluating the library.

The matched c2d is code I have never used before and it doesn’t look like we have a unit test for it, so there is a decent chance it is just a bug. Thanks for the report!

One q - when you refer to gain, do you mean the DC gain of the two systems?

@murrayrm
Copy link
Member

I did a quick check and I agree there is something wrong in the matched transformation:

import control as ct
sysc = ct.tf([1, 2], [1, 3], name='sysc')
sysd_bilinear = ct.sample_system(sysc, 0.1, method='bilinear', name='sysd_bilinear')
sysd_matched = ct.sample_system(sysc, 0.1, method='matched', name='sysd_matched')
ct.bode([sysd_bilinear, sysd_matched, sysc])

This produces the following plot:
Figure_1

A couple of things to fix:

  • Zero frequency gain for the 'matched' transformation is incorrect.
  • The name of the system is lost when doing the 'matched' transformation.
  • The order of the system names is incorrect in the figure title

@murrayrm
Copy link
Member

Fixed in #951. New plot:

Figure_2

murrayrm added a commit that referenced this issue Dec 26, 2023
Fix bug in matched transformation + address other issues in #950
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 a pull request may close this issue.

3 participants