|
81 | 81 | # External function declarations |
82 | 82 | from numpy import angle, any, array, empty, finfo, insert, ndarray, ones, \ |
83 | 83 | polyadd, polymul, polyval, roots, sort, sqrt, zeros, squeeze, exp, pi, \ |
84 | | - where, delete, real, poly |
| 84 | + where, delete, real, poly, poly1d |
85 | 85 | from scipy.signal import lti |
86 | 86 | from copy import deepcopy |
87 | 87 | from warnings import warn |
@@ -231,7 +231,21 @@ def __init__(self, *args): |
231 | 231 | self.den = den |
232 | 232 |
|
233 | 233 | self._truncatecoeff() |
234 | | - |
| 234 | + |
| 235 | + def __call__(self, s): |
| 236 | + """Evaluate the system's transfer function for a complex vairable |
| 237 | +
|
| 238 | + For a SISO transfer function, returns the value of the |
| 239 | + transfer function. For a MIMO transfer fuction, returns a |
| 240 | + matrix of values evaluated at complex variable s.""" |
| 241 | + |
| 242 | + if (self.inputs > 1 or self.outputs > 1): |
| 243 | + # MIMO transfer function, return a matrix |
| 244 | + return self.horner(s) |
| 245 | + else: |
| 246 | + # SISO transfer function, return a scalar |
| 247 | + return self.horner(s)[0][0] |
| 248 | + |
235 | 249 | def _truncatecoeff(self): |
236 | 250 | """Remove extraneous zero coefficients from num and den. |
237 | 251 |
|
@@ -604,7 +618,7 @@ def zero(self): |
604 | 618 | #for now, just give zeros of a SISO tf |
605 | 619 | return roots(self.num[0][0]) |
606 | 620 |
|
607 | | - def feedback(self, other, sign=-1): |
| 621 | + def feedback(self, other=1, sign=-1): |
608 | 622 | """Feedback interconnection between two LTI objects.""" |
609 | 623 |
|
610 | 624 | other = _convertToTransferFunction(other) |
|
0 commit comments