Title: hinfsyn in python-control is returning different results as compared to hinfsyn in MATLAB's robust control toolbox · Issue #367 · python-control/python-control · GitHub
Open Graph Title: hinfsyn in python-control is returning different results as compared to hinfsyn in MATLAB's robust control toolbox · Issue #367 · python-control/python-control
X Title: hinfsyn in python-control is returning different results as compared to hinfsyn in MATLAB's robust control toolbox · Issue #367 · python-control/python-control
Description: Hi, I am very new to control systems, and coding in general. I am currently exploring the H-infinity robust control method and tried implementing the hinfsyn function on a simple spring mass damper system. The following is the code I'm t...
Open Graph Description: Hi, I am very new to control systems, and coding in general. I am currently exploring the H-infinity robust control method and tried implementing the hinfsyn function on a simple spring mass damper...
X Description: Hi, I am very new to control systems, and coding in general. I am currently exploring the H-infinity robust control method and tried implementing the hinfsyn function on a simple spring mass damper...
Opengraph URL: https://github.com/python-control/python-control/issues/367
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"hinfsyn in python-control is returning different results as compared to hinfsyn in MATLAB's robust control toolbox","articleBody":"Hi, \r\n\r\nI am very new to control systems, and coding in general. I am currently exploring the H-infinity robust control method and tried implementing the hinfsyn function on a simple spring mass damper system.\r\n\r\nThe following is the code I'm trying to implement:\r\n\r\n```\r\nimport` control\r\nimport numpy\r\n\r\n\r\n# spring mass damper system\r\nm = 1 # 1 kg\r\nb = 12 # 12 N-s/m\r\nk = 20 # 20 N/m\r\n\r\n\r\nnum = [[[-1], [-1]],[[0], [1]], [[-1], [-1]]]\r\nden = [[[1,1], [m, b, k]], [[1], [1]], [[1,1], [m, b, k]]]\r\nPlant = control.tf2ss(num, den)\r\n#print(Plant)\r\n\r\n\r\nnmeas = 1\r\nncont = 1\r\nK, CL, gamma, rcond = control.hinfsyn(Plant, nmeas, ncont)\r\nprint(K)\r\nprint(gamma)\r\nKtf = control.ss2tf(K);\r\nprint(Ktf);`\r\n```\r\n\r\nThe code returns \"A stabilizing controller cannot be found\"\r\n\r\nHowever, a similar code returns a controller on MATLAB. I have checked and the state space variable \"Plant\" returned by python-control.tf2ss and MATLAB's tf2ss is almost the same (I'm not sure why such a difference arises but I'm assuming MATLAB scales the matrices A, B, C, D).\r\n\r\nCould someone help me out, I'm not sure what I'm doing wrong with my python code. Also let me know if this the wrong forum for posting such a query. I wasn't sure where else to go.\r\n\r\nFor reference:\r\n\r\nI was implementing the model described in Robust Control Design with MATLAB by D.-W. Gu, P. Hr. Petkov and M. M. Konstantinov (Pages 36, 37)\r\n\r\nThe following was my corresponding code in MATLAB: \r\n\r\n```\r\n% spring mass damper system\r\nm = 1; % 1 kg\r\nb = 12; % 12 N-s/m\r\nk = 20; % 20 N/m\r\n\r\n% plant transfer function \r\nGnom = [-tf(1,[1,1]) -tf(1,[m, b, k]);tf(0,1) tf(1,1); -tf(1,[1,1]) -tf(1,[m, b, k])]; \r\n\r\n% state space model of the plant method\r\nP=ss(Gnom); \r\n\r\n% applying hinfinity\r\nnmeas = 1;\r\nncont = 1;\r\n[K, CL, gamma] = hinfsyn(P, nmeas, ncont);\r\ndisp(gamma);\r\n\r\n% displaying the state space model properties of the controller\r\ndisp('K is');\r\ndisp(K);\r\ndisp(K.A);\r\ndisp(K.B);\r\ndisp(K.C);\r\ndisp(K.D);\r\ndisp(size(K));\r\n\r\n%retrieving transfer function of controller method\r\n\r\n[numk, denk] = ss2tf(K.A, K.B, K.C, K.D); \r\nKtf = tf(numk, denk);\r\ndisp('Ktf is');\r\ndisp(Ktf);\r\ndisp(size(Ktf));\r\n```","author":{"url":"https://github.com/Mar-tian","@type":"Person","name":"Mar-tian"},"datePublished":"2020-01-07T08:40:31.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":4},"url":"https://github.com/367/python-control/issues/367"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:6e937d6c-1943-8d24-d08d-d9702f132789 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C2B6:4C179:164DC0E:1E6FA80:697A93DE |
| html-safe-nonce | 953216f9864d4ba0563c625f1cdee919364df59f7b0c3f5ea934051850f70be1 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMkI2OjRDMTc5OjE2NERDMEU6MUU2RkE4MDo2OTdBOTNERSIsInZpc2l0b3JfaWQiOiI4MDA0NjMyODk2MTAwNTM3MzEwIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | f22db3774ae2cb3a5c72bd24c8a64cef73334aa409e83685c2c15558decaf7a5 |
| hovercard-subject-tag | issue:546152816 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python-control/python-control/367/issue_layout |
| twitter:image | https://opengraph.githubassets.com/5e1421558bf3439e9a48e964b7cd46b07cc8fa229aeb110f36eee10e8b8599cd/python-control/python-control/issues/367 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/5e1421558bf3439e9a48e964b7cd46b07cc8fa229aeb110f36eee10e8b8599cd/python-control/python-control/issues/367 |
| og:image:alt | Hi, I am very new to control systems, and coding in general. I am currently exploring the H-infinity robust control method and tried implementing the hinfsyn function on a simple spring mass damper... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Mar-tian |
| hostname | github.com |
| expected-hostname | github.com |
| None | 0912f2a9aa0160e08239520d461a4b4c4ce1caa972a8370b7442b94a38a194c5 |
| turbo-cache-control | no-preview |
| go-import | github.com/python-control/python-control git https://github.com/python-control/python-control.git |
| octolytics-dimension-user_id | 2285872 |
| octolytics-dimension-user_login | python-control |
| octolytics-dimension-repository_id | 22791752 |
| octolytics-dimension-repository_nwo | python-control/python-control |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 22791752 |
| octolytics-dimension-repository_network_root_nwo | python-control/python-control |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | f8f5270c10a913bfa56f2dad4b864f1cda383754 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width