File: cls2dls.sci

package info (click to toggle)
scilab 2.6-4
  • links: PTS
  • area: non-free
  • in suites: woody
  • size: 54,632 kB
  • ctags: 40,267
  • sloc: ansic: 267,851; fortran: 166,549; sh: 10,005; makefile: 4,119; tcl: 1,070; cpp: 233; csh: 143; asm: 135; perl: 130; java: 39
file content (31 lines) | stat: -rw-r--r-- 765 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
function [s1]=cls2dls(s,t,fp)
//Syntax : s1=cls2dls(sl,t [,fp])
//
// Given sl=[a,b,c,d] (syslin list) continuous time system, cls2dls
// returns the sampled system obatined by the bilinear transform
// s=(2/t)*(z-1)/(z+1).
//
// t sampling period
// fp prevarping frequency in hertz
//!
// Copyright INRIA
[lhs,rhs]=argn(0)

if type(s)<>16 then error(91,1),end
flag=s(1); 
if flag(1)<>'lss' then error(91,1),end
if s(7)==[] then warning('cls2dls: s is assumed continuous time');s(7)='c';end
if s(7)<>'c'|s(7)=='d' then
  warning('needs a continuous system as input !')
end
fs=1/t 
if rhs==3 then fp=2*%pi*fp;fs=fp/tan(fp/fs/2)/2,end //prewarping
 
a=2*fs*eye()-s(2)
ad=a\(2*fs*eye()+s(2))
b=(ad+eye())/a*s(3);
d=s(5)+s(4)/a*s(3)
s1=syslin('d',ad,b,s(4),d,s(6))