|
1 | 1 | from __future__ import division |
2 | | -"""frdata.py |
3 | | -
|
| 2 | +""" |
4 | 3 | Frequency response data representation and functions. |
5 | 4 |
|
6 | | -This file contains the FRD class and also functions that operate on |
| 5 | +This module contains the FRD class and also functions that operate on |
7 | 6 | FRD data. |
8 | | -
|
9 | | -Routines in this module: |
10 | | -
|
11 | | -FRD.__init__ |
12 | | -FRD.copy |
13 | | -FRD.__str__ |
14 | | -FRD.__neg__ |
15 | | -FRD.__add__ |
16 | | -FRD.__radd__ |
17 | | -FRD.__sub__ |
18 | | -FRD.__rsub__ |
19 | | -FRD.__mul__ |
20 | | -FRD.__rmul__ |
21 | | -FRD.__div__ |
22 | | -FRD.__rdiv__ |
23 | | -FRD.__truediv__ |
24 | | -FRD.__rtruediv__ |
25 | | -FRD.evalfr |
26 | | -FRD.freqresp |
27 | | -FRD.pole |
28 | | -FRD.zero |
29 | | -FRD.feedback |
30 | | -FRD._common_den |
31 | | -_convertToFRD |
32 | | -
|
33 | 7 | """ |
34 | 8 |
|
35 | 9 | """Copyright (c) 2010 by California Institute of Technology |
|
80 | 54 | from scipy.interpolate import splprep, splev |
81 | 55 | from .lti import LTI |
82 | 56 |
|
| 57 | +__all__ = ['FRD', 'frd'] |
| 58 | + |
83 | 59 | class FRD(LTI): |
84 | 60 | """A class for models defined by Frequency Response Data (FRD) |
85 | 61 |
|
@@ -480,3 +456,39 @@ def _convertToFRD(sys, omega, inputs=1, outputs=1): |
480 | 456 |
|
481 | 457 | raise TypeError('''Can't convert given type "%s" to FRD system.''' % |
482 | 458 | sys.__class__) |
| 459 | + |
| 460 | +def frd(*args): |
| 461 | + ''' |
| 462 | + Construct a Frequency Response Data model, or convert a system |
| 463 | +
|
| 464 | + frd models store the (measured) frequency response of a system. |
| 465 | +
|
| 466 | + This function can be called in different ways: |
| 467 | +
|
| 468 | + ``frd(response, freqs)`` |
| 469 | + Create an frd model with the given response data, in the form of |
| 470 | + complex response vector, at matching frequency freqs [in rad/s] |
| 471 | +
|
| 472 | + ``frd(sys, freqs)`` |
| 473 | + Convert an LTI system into an frd model with data at frequencies |
| 474 | + freqs. |
| 475 | +
|
| 476 | + Parameters |
| 477 | + ---------- |
| 478 | + response: array_like, or list |
| 479 | + complex vector with the system response |
| 480 | + freq: array_lik or lis |
| 481 | + vector with frequencies |
| 482 | + sys: LTI (StateSpace or TransferFunction) |
| 483 | + A linear system |
| 484 | +
|
| 485 | + Returns |
| 486 | + ------- |
| 487 | + sys: FRD |
| 488 | + New frequency response system |
| 489 | +
|
| 490 | + See Also |
| 491 | + -------- |
| 492 | + ss, tf |
| 493 | + ''' |
| 494 | + return FRD(*args) |
0 commit comments