|
From: <kk...@us...> - 2011-02-08 22:19:05
|
Revision: 112
http://python-control.svn.sourceforge.net/python-control/?rev=112&view=rev
Author: kkchen
Date: 2011-02-08 22:18:58 +0000 (Tue, 08 Feb 2011)
Log Message:
-----------
Fixed pzmap.py for transfer functions. Still not implemented for state space.
Lauren Padilla <lpa...@pr...>
Modified Paths:
--------------
branches/control-0.4a/examples/pvtol-nested.py
branches/control-0.4a/examples/type2_type3.py
branches/control-0.4a/src/pzmap.py
Modified: branches/control-0.4a/examples/pvtol-nested.py
===================================================================
--- branches/control-0.4a/examples/pvtol-nested.py 2011-02-08 22:18:53 UTC (rev 111)
+++ branches/control-0.4a/examples/pvtol-nested.py 2011-02-08 22:18:58 UTC (rev 112)
@@ -24,8 +24,8 @@
Po = tf([1], [m, c, 0]); # outer loop (position)
# Use state space versions
-# Pi = tf2ss(Pi);
-# Po = tf2ss(Po);
+Pi = tf2ss(Pi);
+Po = tf2ss(Po);
#
# Inner loop control design
Modified: branches/control-0.4a/examples/type2_type3.py
===================================================================
--- branches/control-0.4a/examples/type2_type3.py 2011-02-08 22:18:53 UTC (rev 111)
+++ branches/control-0.4a/examples/type2_type3.py 2011-02-08 22:18:58 UTC (rev 112)
@@ -15,7 +15,7 @@
Kii = Ki
# Plant transfer function from torque to rate
-inertia = integrator*(1/J)
+inertia = integrator*1/J
friction = b # transfer function from rate to torque
P = inertia # friction is modelled as a separate block
Modified: branches/control-0.4a/src/pzmap.py
===================================================================
--- branches/control-0.4a/src/pzmap.py 2011-02-08 22:18:53 UTC (rev 111)
+++ branches/control-0.4a/src/pzmap.py 2011-02-08 22:18:58 UTC (rev 112)
@@ -42,6 +42,7 @@
import matplotlib.pyplot as plt
import scipy as sp
+import numpy as np
import xferfcn
# Compute poles and zeros for a system
@@ -49,8 +50,8 @@
def pzmap(sys, Plot=True):
"""Plot a pole/zero map for a transfer function"""
if (isinstance(sys, xferfcn.TransferFunction)):
- poles = sp.roots(sys.den);
- zeros = sp.roots(sys.num);
+ poles = sp.roots(np.squeeze(np.asarray(sys.den)));
+ zeros = sp.roots(np.squeeze(np.asarray(sys.num)));
else:
raise NotImplementedError("pzmap not implemented for state space systems yet.")
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|