Skip to content

Issue with control.phase_plot #96

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

Closed
ghost opened this issue Jun 7, 2016 · 2 comments
Closed

Issue with control.phase_plot #96

ghost opened this issue Jun 7, 2016 · 2 comments
Assignees

Comments

@ghost
Copy link

ghost commented Jun 7, 2016

In the python-control documentation:
http://python-control.readthedocs.io/en/latest/generated/control.phase_plot.html

It says that the phase_plot function "Produces a vector field or stream line plot for a planar system."

It also shows how to plot only streamlines:
"phase_plot(func. X0=(...), T=Tmax, ...)"

I followed this direction with this code:
"def d1(x1x2,t):
x1,x2 = x1x2
return np.array([x2, x2 - 2*x1])

x1x2_0 = np.array([[-1.,1.],[-1.,-1.],[1.,1.],[1.,-1.],[-1.,0.],[1.,0.],[0.,-1.],[0.,1.],[0.,0.]])

plt.figure(1)
control.phase_plot(d1,X0=x1x2_0,T=100)"

However, I get a TypeError:
"TypeError Traceback (most recent call last)
in ()
11
12 plt.figure(1)
---> 13 control.phase_plot(d1,X0=x1x2_0,T=100)
14
15 def d2(x1x2,t):

/home/aramakri/cds/local/lib/python2.7/site-packages/control/phaseplot.pyc in phase_plot(odefun, X, Y, scale, X0, T, lingrid, lintime, logtime, timepts, parms, verbose)
129 #! TODO: Add sanity checks
130 (x1, x2) = np.meshgrid(
--> 131 frange(X[0], X[1], float(X[1]-X[0])/X[2]),
132 frange(Y[0], Y[1], float(Y[1]-Y[0])/Y[2]));
133

TypeError: 'NoneType' object has no attribute 'getitem'"

It assumes that there is a meshgrid to plot arrows and returns an error when there is none.

I am trying to plot the streamlines without the arrows because when arrows are plotted, they are so thick that the actual graph is obscured.

@murrayrm
Copy link
Member

I've verified the bug and set up a branch to fix this.

@murrayrm murrayrm self-assigned this Jun 13, 2016
@slivingston
Copy link
Member

fixed in commit 0104e4b.

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

No branches or pull requests

2 participants