License Header change: Removed the LICENSE_END before beta
[scilab.git] / scilab / modules / cacsd / help / en_US / flts.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!--
3  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
4  * Copyright (C) INRIA - 
5  * 
6  * Copyright (C) 2012 - 2016 - Scilab Enterprises
7  *
8  * This file is hereby licensed under the terms of the GNU GPL v2.0,
9  * pursuant to article 5.3.4 of the CeCILL v.2.1.
10  * This file was originally licensed under the terms of the CeCILL v2.1,
11  * and continues to be available under such terms.
12  * For more information, see the COPYING file which you should have received
13  * along with this program.
14  *
15  -->
16 <refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns4="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="flts" xml:lang="en">
17     <refnamediv>
18         <refname>flts</refname>
19         <refpurpose>time response (discrete time, sampled system)</refpurpose>
20     </refnamediv>
21     <refsynopsisdiv>
22         <title>Calling Sequence</title>
23         <synopsis>[y [,x]]=flts(u,sl [,x0])
24             [y]=flts(u,sl [,past])
25         </synopsis>
26     </refsynopsisdiv>
27     <refsection>
28         <title>Arguments</title>
29         <variablelist>
30             <varlistentry>
31                 <term>u</term>
32                 <listitem>
33                     <para>matrix (input vector)</para>
34                 </listitem>
35             </varlistentry>
36             <varlistentry>
37                 <term>sl</term>
38                 <listitem>
39                     <para>
40                         list (linear system <literal>syslin</literal>)
41                     </para>
42                 </listitem>
43             </varlistentry>
44             <varlistentry>
45                 <term>x0</term>
46                 <listitem>
47                     <para>vector (initial state ; default
48                         value=<literal>0</literal>)
49                     </para>
50                 </listitem>
51             </varlistentry>
52             <varlistentry>
53                 <term>past</term>
54                 <listitem>
55                     <para>matrix (of the past ; default
56                         value=<literal>0</literal>)
57                     </para>
58                 </listitem>
59             </varlistentry>
60             <varlistentry>
61                 <term>x,y</term>
62                 <listitem>
63                     <para>matrices (state and output)</para>
64                 </listitem>
65             </varlistentry>
66         </variablelist>
67     </refsection>
68     <refsection>
69         <title>Description</title>
70         <itemizedlist>
71             <listitem>
72                 <para>State-space form:</para>
73             </listitem>
74         </itemizedlist>
75         <para>
76             <literal>sl</literal> is a discrete linear system given by its state
77             space representation (see <link linkend="syslin">syslin</link> ):
78         </para>
79         <para>
80             <literal>sl=syslin('d',A,B,C,D)</literal> :
81         </para>
82         <programlisting role=""><![CDATA[ 
83 x[t+1] = A x[t] + B u[t]
84 y[t] = C x[t] + D u[t]
85  ]]></programlisting>
86         <para>
87             or, more generally, if <literal>D</literal> is a polynomial matrix
88             (<literal>p = degree(D(z))</literal>) :
89         </para>
90         <programlisting role=""><![CDATA[ 
91 D(z) = D_0 + z D_1 + z^2 D_2 +..+ z^p D_p
92 y[t] = C x[t] + D_0 u[t] + D_1 u[t+1] +..+ D_[p] u[t+p]
93  ]]></programlisting>
94         <itemizedlist>
95             <listitem>
96                 <para>Transfer form:</para>
97             </listitem>
98         </itemizedlist>
99         <para>
100             <literal> y=flts(u,sl[,past])</literal>. Here <literal>sl</literal>
101             is a linear system in transfer matrix representation i.e
102         </para>
103         <para>
104             <literal>sl=syslin('d',transfer_matrix)</literal> (see
105             <literal>
106                 <link linkend="syslin">syslin</link>
107             </literal>
108             ).
109         </para>
110         <programlisting role=""><![CDATA[ 
111 past = [u     ,...,  u   ]
112        [ -nd           -1]
113        [y     ,...,  y   ]
114        [ -nd           -1]
115  ]]></programlisting>
116         <para>is the matrix of past values of u and y.</para>
117         <para>
118             <literal>nd</literal> is the maximum of degrees of lcm's of each row
119             of the denominator matrix of <literal>sl</literal>.
120         </para>
121         <programlisting role=""><![CDATA[ 
122 u=[u0 u1 ... un]  (input)
123 y=[y0 y1 ... yn]  (output)
124  ]]></programlisting>
125         <para>p is the difference between maximum degree of numerator and maximum
126             degree of denominator
127         </para>
128     </refsection>
129     <refsection>
130         <title>Examples</title>
131         <programlisting role="example"><![CDATA[ 
132 sl=syslin('d',1,1,1);u=1:10;
133 y=flts(u,sl); 
134 plot2d(y)
135 [y1,x1]=flts(u(1:5),sl);y2=flts(u(6:10),sl,x1);
136 y-[y1,y2]
137
138 //With polynomial D:
139 z=poly(0,'z');
140 D=1+z+z^2; p =degree(D);
141 sl=syslin('d',1,1,1,D);
142 y=flts(u,sl);[y1,x1]=flts(u(1:5),sl);
143 y2=flts(u(5-p+1:10),sl,x1);  // (update)
144 y-[y1,y2]
145
146 //Delay (transfer form): flts(u,1/z)
147 // Usual responses
148 z=poly(0,'z');
149 h=syslin(0.1,(1-2*z)/(z^2+0.3*z+1))
150 imprep=flts(eye(1,20),tf2ss(h));   //Impulse response
151 clf();
152 plot(imprep,'b')
153 u=ones(1,20);
154 stprep=flts(ones(1,20),tf2ss(h));   //Step response
155 plot(stprep,'g')
156  ]]></programlisting>
157         <scilab:image>
158             sl=syslin('d',1,1,1);u=1:10;
159             y=flts(u,sl);
160             plot2d(y)
161             [y1,x1]=flts(u(1:5),sl);y2=flts(u(6:10),sl,x1);
162             y-[y1,y2]
163             
164             z=poly(0,'z');
165             D=1+z+z^2; p =degree(D);
166             sl=syslin('d',1,1,1,D);
167             y=flts(u,sl);[y1,x1]=flts(u(1:5),sl);
168             y2=flts(u(5-p+1:10),sl,x1);
169             y-[y1,y2]
170             
171             z=poly(0,'z');
172             h=syslin(0.1,(1-2*z)/(z^2+0.3*z+1))
173             imprep=flts(eye(1,20),tf2ss(h));
174             clf();
175             plot(imprep,'b')
176             u=ones(1,20);
177             stprep=flts(ones(1,20),tf2ss(h));
178             plot(stprep,'g')
179         </scilab:image>
180         <programlisting role="example"><![CDATA[ 
181 // Other examples
182 A=[1 2 3;0 2 4;0 0 1];
183 B=[1 0;0 0;0 1];
184 C=eye(3,3);
185 Sys=syslin('d',A,B,C);
186 H=ss2tf(Sys); u=[1;-1]*(1:10);
187 //
188 yh=flts(u,H); ys=flts(u,Sys);
189 norm(yh-ys,1)
190 //hot restart
191 [ys1,x]=flts(u(:,1:4),Sys);ys2=flts(u(:,5:10),Sys,x);
192 norm([ys1,ys2]-ys,1)
193 //
194 yh1=flts(u(:,1:4),H);yh2=flts(u(:,5:10),H,[u(:,2:4);yh(:,2:4)]);
195 norm([yh1,yh2]-yh,1)
196 //with D&lt;&gt;0
197 D=[-3 8;4 -0.5;2.2 0.9];
198 Sys=syslin('d',A,B,C,D);
199 H=ss2tf(Sys); u=[1;-1]*(1:10);
200 rh=flts(u,H); rs=flts(u,Sys);
201 norm(rh-rs,1)
202 //hot restart
203 [ys1,x]=flts(u(:,1:4),Sys);ys2=flts(u(:,5:10),Sys,x);
204 norm([ys1,ys2]-rs,1)
205 //With H:
206 yh1=flts(u(:,1:4),H);yh2=flts(u(:,5:10),H,[u(:,2:4); yh1(:,2:4)]);
207 norm([yh1,yh2]-rh)
208  ]]></programlisting>
209     </refsection>
210     <refsection role="see also">
211         <title>See Also</title>
212         <simplelist type="inline">
213             <member>
214                 <link linkend="ltitr">ltitr</link>
215             </member>
216             <member>
217                 <link linkend="dsimul">dsimul</link>
218             </member>
219             <member>
220                 <link linkend="rtitr">rtitr</link>
221             </member>
222         </simplelist>
223     </refsection>
224 </refentry>