author | Puneeth Chaganti <punchagan@fossee.in> |
Fri, 27 May 2011 14:24:59 +0530 | |
changeset 0 | 0efde00f9229 |
permissions | -rw-r--r-- |
0 | 1 |
import scipy as sp |
2 |
from scipy import linalg |
|
3 |
from scipy import signal |
|
4 |
||
5 |
def dscr(H,Ts): |
|
6 |
""" Given a Continuous system and a Time step, returns a discretized system.""" |
|
7 |
(n,m) = H.B.shape |
|
8 |
S = sp.zeros((n+m,n+m)) |
|
9 |
S[:n,:n] = H.A |
|
10 |
S[:n,n:] = H.B |
|
11 |
s = linalg.expm(S*Ts) |
|
12 |
f = s[:n,:n] |
|
13 |
g = s[:n,n:] |
|
14 |
Hd = signal.lti(f, g, H.C, H.D) |
|
15 |
return Hd |