|
75 | 75 | # External function declarations |
76 | 76 | from numpy import angle, any, array, empty, finfo, insert, ndarray, ones, \ |
77 | 77 | polyadd, polymul, polyval, roots, sort, sqrt, zeros, squeeze, inner, \ |
78 | | - real, imag, matrix, absolute, eye, linalg |
| 78 | + real, imag, matrix, absolute, eye, linalg, pi |
79 | 79 | from scipy.interpolate import splprep, splev |
80 | 80 | from copy import deepcopy |
81 | 81 | from lti import Lti |
@@ -187,10 +187,15 @@ def __str__(self): |
187 | 187 | for j in range(self.outputs): |
188 | 188 | if mimo: |
189 | 189 | outstr.append("Input %i to output %i:" % (i + 1, j + 1)) |
190 | | - outstr.append('Freq [rad/s] Magnitude Phase') |
| 190 | + outstr.append('Freq [rad/s] Magnitude Phase') |
| 191 | + outstr.append('------------ ----------- -----------') |
| 192 | +# outstr.extend( |
| 193 | +# [ '%12.3f %11.3e %11.2f' % (w, m, p*180.0/pi) |
| 194 | +# for m, p, w in zip(mt[i][j], pt[i][j], wt) ]) |
191 | 195 | outstr.extend( |
192 | | - [ '%f %f %f' % (w, m, p*180.0) |
193 | | - for m, p, w in zip(mt[i][j], pt[i][j], wt) ]) |
| 196 | + [ '%12.3f %10.4g + %10.4g' % (w, m, p) |
| 197 | + for m, p, w in zip(real(self.fresp[i,j,:]), imag(self.fresp[i,j,:]), wt) ]) |
| 198 | + |
194 | 199 |
|
195 | 200 | return '\n'.join(outstr) |
196 | 201 |
|
@@ -385,8 +390,9 @@ def feedback(self, other, sign=-1): |
385 | 390 | # TODO: handle omega re-mapping |
386 | 391 | for k, w in enumerate(other.omega): |
387 | 392 | fresp[:, :, k] = linalg.solve( |
388 | | - eye(self.inputs) + other.fresp[:, :, k].view(type=matrix) * |
389 | | - self.fresp[:, :, k].view(type=matrix), |
| 393 | + eye(self.inputs) + |
| 394 | + self.fresp[:, :, k].view(type=matrix) * |
| 395 | + other.fresp[:, :, k].view(type=matrix), |
390 | 396 | eye(self.inputs))*self.fresp[:, :, k].view(type=matrix) |
391 | 397 |
|
392 | 398 | # for i in range(self.inputs): |
|
0 commit comments