Title: Strange nondeterministic issues when using `phase_plot` with `X`, `Y` and `X0` set · Issue #970 · python-control/python-control · GitHub
Open Graph Title: Strange nondeterministic issues when using `phase_plot` with `X`, `Y` and `X0` set · Issue #970 · python-control/python-control
X Title: Strange nondeterministic issues when using `phase_plot` with `X`, `Y` and `X0` set · Issue #970 · python-control/python-control
Description: I am trying to draw a phase plot with both streamlines and a vector field. Using the inverted pendulum ODE from https://python-control.readthedocs.io/en/latest/phaseplots.html, I put together the following script: import numpy as np impo...
Open Graph Description: I am trying to draw a phase plot with both streamlines and a vector field. Using the inverted pendulum ODE from https://python-control.readthedocs.io/en/latest/phaseplots.html, I put together the f...
X Description: I am trying to draw a phase plot with both streamlines and a vector field. Using the inverted pendulum ODE from https://python-control.readthedocs.io/en/latest/phaseplots.html, I put together the f...
Opengraph URL: https://github.com/python-control/python-control/issues/970
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Strange nondeterministic issues when using `phase_plot` with `X`, `Y` and `X0` set","articleBody":"I am trying to draw a phase plot with both streamlines and a vector field. Using the inverted pendulum ODE from https://python-control.readthedocs.io/en/latest/phaseplots.html, I put together the following script:\r\n```python\r\nimport numpy as np\r\nimport matplotlib.pyplot as plt\r\nfrom control.phaseplot import phase_plot\r\n\r\n# Define the ODEs for a damped (inverted) pendulum\r\ndef invpend_ode(x, t, m=1., l=1., b=0.2, g=1):\r\n return x[1], -b/m*x[1] + (g*l/m)*np.sin(x[0])\r\n\r\n# Set up the figure the way we want it to look\r\nplt.figure()\r\nplt.title('Inverted pendulum')\r\n\r\n# Outer trajectories\r\nphase_plot(\r\n invpend_ode,\r\n X=(-10, 10, 20),\r\n Y=(-10, 10, 20),\r\n X0=[[-2*np.pi, 1.6], [-2*np.pi, 0.5], [-1.8, 2.1],\r\n [-1, 2.1], [4.2, 2.1], [5, 2.1],\r\n [2*np.pi, -1.6], [2*np.pi, -0.5], [1.8, -2.1],\r\n [1, -2.1], [-4.2, -2.1], [-5, -2.1]]\r\n)\r\n\r\nplt.show()\r\n```\r\n\r\nI would have expected this to plot a simple vector field with a grid of 20*20 arrows and streamlines from the given inital conditions. Instead, each time I run this I get a different malformed plot, often with at least one axis somehow having arrows at values like 10^281. Various RuntimeWarnings about overflow are also sometimes printed in the console. Some examples of the plots I have gotten:\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\nThis does not seem like expected behaviour. What is going on here?\r\n\r\nTested on Windows 10 with Python 3.10.11, matplotlib 3.8.2 and control 0.9.4 from pip.","author":{"url":"https://github.com/FeldrinH","@type":"Person","name":"FeldrinH"},"datePublished":"2024-02-13T23:57:59.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/970/python-control/issues/970"}
| 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:89570977-0926-a351-7318-0766eb98383f |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A0A2:1EB0ED:16DDB3:1FF6A7:697B3E74 |
| html-safe-nonce | c4554ad0adc117d0c3dcf6bd3e0679b6ac4a804ac9dc85fe61959aeee0441ca9 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBMEEyOjFFQjBFRDoxNkREQjM6MUZGNkE3OjY5N0IzRTc0IiwidmlzaXRvcl9pZCI6IjE2ODc5NTcxODMxNDU5MTgwNjgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 099384f0e1750cd618b27eb5444670d13634a31113fe9a45996390b415f17066 |
| hovercard-subject-tag | issue:2133321369 |
| 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/970/issue_layout |
| twitter:image | https://opengraph.githubassets.com/aad863404e82f980835a1673829442d152efe52d132f63bf231c0322efb98809/python-control/python-control/issues/970 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/aad863404e82f980835a1673829442d152efe52d132f63bf231c0322efb98809/python-control/python-control/issues/970 |
| og:image:alt | I am trying to draw a phase plot with both streamlines and a vector field. Using the inverted pendulum ODE from https://python-control.readthedocs.io/en/latest/phaseplots.html, I put together the f... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | FeldrinH |
| hostname | github.com |
| expected-hostname | github.com |
| None | 6fe64d94889230be19a900846cfc91707e7dd4206878d6c208922b46a6b0735d |
| 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 | 15736a47b83581130a149aa1b928696bea06adde |
| ui-target | canary-1 |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width