1 ## Copyright (C) 2011 Lukas F. Reichlin
3 ## This file is part of LTI Syncope.
5 ## LTI Syncope is free software: you can redistribute it and/or modify
6 ## it under the terms of the GNU General Public License as published by
7 ## the Free Software Foundation, either version 3 of the License, or
8 ## (at your option) any later version.
10 ## LTI Syncope is distributed in the hope that it will be useful,
11 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 ## GNU General Public License for more details.
15 ## You should have received a copy of the GNU General Public License
16 ## along with LTI Syncope. If not, see <http://www.gnu.org/licenses/>.
19 ## 1. Discrete -> continuous
23 ## A = beta (A - alpha*E)
25 ## B = sqrt(2*alpha*beta) * B
27 ## C = sqrt(2*alpha*beta) * C * (alpha*E + A) * E
29 ## D = D - C * (alpha*E + A) * B
32 ## 2. Continuous -> discrete
36 ## A = alpha (beta*E + A)
38 ## B = sqrt(2*alpha*beta) * B
40 ## C = sqrt(2*alpha*beta) * C * (beta*E - A) * E
42 ## D = D + C * (beta*E - A) * B
44 ## Special thanks to Andras Varga for the formulae.
45 ## Author: Lukas Reichlin <lukas.reichlin@gmail.com>
46 ## Created: October 2011
49 function [Ar, Br, Cr, Dr, Er] = __dss_bilin__ (A, B, C, D, E, beta, discrete)
54 if (rcond (EpA) < eps)
55 error ("d2c: E+A singular");
66 ## Ar = beta * (A - E);
67 ## Br = sqrt (2*beta) * B;
68 ## Cr = sqrt (2*beta) * C / (E + A) * E;
69 ## Dr = D - C / (E + A) * B;
73 if (rcond (bEmA) < eps)
74 error ("c2d: beta*E-A singular");
81 Cr = s2b * CibEmA * E;
86 ## Br = sqrt (2*beta) * B;
87 ## Cr = sqrt (2*beta) * C / (beta*E - A) * E;
88 ## Dr = D + C / (beta*E - A) * B;