3
3
#
4
4
# Author: Sawyer Fuller
5
5
# Date: 26 Aug 2010
6
- #
6
+ #
7
7
# This file contains functions for implementing time delays (currently
8
8
# only the pade() function).
9
9
#
16
16
#
17
17
# 1. Redistributions of source code must retain the above copyright
18
18
# notice, this list of conditions and the following disclaimer.
19
- #
19
+ #
20
20
# 2. Redistributions in binary form must reproduce the above copyright
21
21
# notice, this list of conditions and the following disclaimer in the
22
22
# documentation and/or other materials provided with the distribution.
23
- #
23
+ #
24
24
# 3. Neither the name of the California Institute of Technology nor
25
25
# the names of its contributors may be used to endorse or promote
26
26
# products derived from this software without specific prior
27
27
# written permission.
28
- #
28
+ #
29
29
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
30
30
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
31
31
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
38
38
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
39
39
# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
40
40
# SUCH DAMAGE.
41
- #
41
+ #
42
42
# $Id$
43
43
44
44
# Python 3 compatability (needs to go here)
45
45
from __future__ import print_function
46
46
47
47
def pade (T , n = 1 ):
48
- """
48
+ """
49
49
Create a linear system that approximates a delay.
50
-
50
+
51
51
Return the numerator and denominator coefficients of the Pade approximation.
52
-
52
+
53
53
Parameters
54
54
----------
55
55
T : number
56
56
time delay
57
57
n : integer
58
58
order of approximation
59
-
59
+
60
60
Returns
61
- -------
61
+ -------
62
62
num, den : array
63
63
Polynomial coefficients of the delay model, in descending powers of s.
64
-
64
+
65
65
Notes
66
66
-----
67
67
Based on an algorithm in Golub and van Loan, "Matrix Computation" 3rd.
@@ -79,7 +79,7 @@ def pade(T, n=1):
79
79
for k in range (1 , n + 1 ):
80
80
c = T * c * (n - k + 1 )/ (2 * n - k + 1 )/ k
81
81
num [n - k ] = c * (- 1 )** k
82
- den [n - k ] = c
82
+ den [n - k ] = c
83
83
num = [coeff / den [0 ] for coeff in num ]
84
84
den = [coeff / den [0 ] for coeff in den ]
85
- return num , den
85
+ return num , den
0 commit comments