Skip to content

Commit 1b9070a

Browse files
committed
Move matlab.frd to frdata module
1 parent d1d6659 commit 1b9070a

3 files changed

Lines changed: 42 additions & 68 deletions

File tree

control/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
impulse_response
6666
from .xferfcn import *
6767
from .ctrlutil import *
68-
from .frdata import FRD
68+
from .frdata import *
6969
from .canonical import canonical_form, reachable_form
7070

7171
# Exceptions

control/frdata.py

Lines changed: 40 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,9 @@
11
from __future__ import division
2-
"""frdata.py
3-
2+
"""
43
Frequency response data representation and functions.
54
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
76
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-
337
"""
348

359
"""Copyright (c) 2010 by California Institute of Technology
@@ -80,6 +54,8 @@
8054
from scipy.interpolate import splprep, splev
8155
from .lti import LTI
8256

57+
__all__ = ['FRD', 'frd']
58+
8359
class FRD(LTI):
8460
"""A class for models defined by Frequency Response Data (FRD)
8561
@@ -480,3 +456,39 @@ def _convertToFRD(sys, omega, inputs=1, outputs=1):
480456

481457
raise TypeError('''Can't convert given type "%s" to FRD system.''' %
482458
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)

control/matlab/__init__.py

Lines changed: 1 addition & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
from ..statesp import *
8181
from ..xferfcn import *
8282
from ..lti import issiso
83-
from ..frdata import FRD
83+
from ..frdata import *
8484
from ..dtime import sample_system
8585
from ..exception import ControlArgument
8686
from .timeresp import *
@@ -388,44 +388,6 @@
388388
"""
389389

390390

391-
def frd(*args):
392-
'''
393-
Construct a Frequency Response Data model, or convert a system
394-
395-
frd models store the (measured) frequency response of a system.
396-
397-
This function can be called in different ways:
398-
399-
``frd(response, freqs)``
400-
Create an frd model with the given response data, in the form of
401-
complex response vector, at matching frequency freqs [in rad/s]
402-
403-
``frd(sys, freqs)``
404-
Convert an LTI system into an frd model with data at frequencies
405-
freqs.
406-
407-
Parameters
408-
----------
409-
response: array_like, or list
410-
complex vector with the system response
411-
freq: array_lik or lis
412-
vector with frequencies
413-
sys: LTI (StateSpace or TransferFunction)
414-
A linear system
415-
416-
Returns
417-
-------
418-
sys: FRD
419-
New frequency response system
420-
421-
See Also
422-
--------
423-
ss, tf
424-
'''
425-
return FRD(*args)
426-
427-
428-
429391
def pole(sys):
430392
"""
431393
Compute system poles.

0 commit comments

Comments
 (0)