summaryrefslogtreecommitdiff
path: root/modules/cacsd/help/en_US/rtitr.xml
blob: 6034aed942fc88e406c541c1f589568381a2e299 (plain)
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
<?xml version="1.0" encoding="UTF-8"?>
<!--
 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
 * Copyright (C) INRIA - 
 * 
 * This file must be used under the terms of the CeCILL.
 * This source file is licensed as described in the file COPYING, which
 * you should have received as part of this distribution.  The terms
 * are also available at    
 * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
 *
 -->
<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:lang="en" xml:id="rtitr">
    <refnamediv>
        <refname>rtitr</refname>
        <refpurpose>discrete time response (transfer matrix)  </refpurpose>
    </refnamediv>
    <refsynopsisdiv>
        <title>Calling Sequence</title>
        <synopsis>[y]=rtitr(Num,Den,u [,up,yp])</synopsis>
    </refsynopsisdiv>
    <refsection>
        <title>Arguments</title>
        <variablelist>
            <varlistentry>
                <term>Num,Den</term>
                <listitem>
                    <para>
                        polynomial  matrices (resp. dimensions : <literal>n</literal>x<literal>m</literal> and <literal>n</literal>x<literal>n</literal>)
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>u</term>
                <listitem>
                    <para>
                        real matrix (dimension <literal>m</literal>x<literal>(t+1)</literal>
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>up,yp</term>
                <listitem>
                    <para>
                        real matrices (<literal>up</literal> dimension <literal>m</literal>x<literal>(max(degree(Den)))</literal> (default values=<literal>0</literal>) ,
                        <literal>yp</literal> dimension <literal>n</literal>x 
                        <literal>(max(degree(Den)))</literal>)
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>y</term>
                <listitem>
                    <para>real matrix</para>
                </listitem>
            </varlistentry>
        </variablelist>
    </refsection>
    <refsection>
        <title>Description</title>
        <para>
            <literal>y=rtitr(Num,Den,u [,up,yp])</literal> returns the time response of
            the discrete time linear system with transfer matrix <literal>Den^-1 Num</literal> 
            for the input <literal>u</literal>, i.e <literal>y</literal> and <literal>u</literal> are such that <literal>Den y = Num u</literal> at t=0,1,...
        </para>
        <para>
            If <literal>d1=max(degree(Den))</literal>, and <literal>d2=max(degree(Num))</literal> the polynomial 
            matrices  <literal>Den(z)</literal> and <literal>Num(z)</literal> may be written respectively as:
        </para>
        <programlisting role=""><![CDATA[ 
D(z) = D_0  + D_1  z + ... + D_d1   z^d1
N(z) = N_0  + N_1  z + ... + N_d2   z^d2
 ]]></programlisting>
        <para>
            and <literal>Den y = Num u</literal> is interpreted as the recursion:
        </para>
        <programlisting role=""><![CDATA[ 
D(0)y(t)+D(1)y(t+1)+...+ D(d1)y(t+d1)= N(0) u(t) +....+ N(d2) u(t+d2)
 ]]></programlisting>
        <para>
            It is assumed that <literal>D(d1)</literal> is non singular.
        </para>
        <para>
            The columns of u are the inputs of the system at t=0,1,...,T:
        </para>
        <programlisting role=""><![CDATA[ 
u=[u(0) , u(1),...,u(T)]
 ]]></programlisting>
        <para>
            The outputs at <literal>t=0,1,...,T+d1-d2</literal> are the columns of the matrix <literal>y</literal>:
        </para>
        <programlisting role=""><![CDATA[ 
y = [y(0), y(1),  .... y(T+d1-d2)]
 ]]></programlisting>
        <para>
            <literal>up</literal> and <literal>yp</literal> define the initial conditions for t &lt; 0 i.e
        </para>
        <programlisting role=""><![CDATA[ 
up = [u(-d1), ..., u(-1)  ]
yp = [y(-d1), ...  y(-1)  ]
 ]]></programlisting>
        <para>
            Depending on the relative values of <literal>d1</literal> and <literal>d2</literal>, some of the
            leftmost components of <literal>up</literal>, <literal>yp</literal> are ignored.
            The default values of <literal>up</literal> and <literal>yp</literal> are zero:
            <literal>up = 0*ones(m,d1), yp=0*ones(n,d1)</literal>
        </para>
    </refsection>
    <refsection>
        <title>Examples</title>
        <programlisting role="example"><![CDATA[ 
z=poly(0,'z');
Num=1+z;
Den=1+z;
u=[1,2,3,4,5];
rtitr(Num,Den,u)-u
 ]]></programlisting>
        <programlisting role="example"><![CDATA[ 
//Other examples
//siso
//causal
n1=1;
d1=poly([1 1],'z','coeff');       // y(j)=-y(j-1)+u(j-1)
r1=[0 1 0 1 0 1 0 1 0 1 0];
r=rtitr(n1,d1,ones(1,10));
norm(r1-r,1)
//hot restart
r=rtitr(n1,d1,ones(1,9),1,0);
norm(r1(2:11)-r)
//non causal
n2=poly([1 1 1],'z','coeff');
d2=d1;    // y(j)=-y(j-1)+u(j-1)+u(j)+u(j+1)
r2=[2 1 2 1 2 1 2 1 2];
r=rtitr(n2,d2,ones(1,10));
norm(r-r2,1)
//hot restart
r=rtitr(n2,d2,ones(1,9),1,2);
norm(r2(2:9)-r,1)
//
//MIMO example
//causal
d1=d1*diag([1 0.5]);
n1=[1 3 1;2 4 1];
r1=[5;14]*r1;
r=rtitr(n1,d1,ones(3,10));
norm(r1-r,1)
//
r=rtitr(n1,d1,ones(3,9),[1;1;1],[0;0]);
norm(r1(:,2:11)-r,1)
//polynomial n1  (same ex.)
n1(1,1)=poly(1,'z','c');
r=rtitr(n1,d1,ones(3,10));
norm(r1-r,1)
//
r=rtitr(n1,d1,ones(3,9),[1;1;1],[0;0]);
norm(r1(:,2:11)-r,1)
//non causal
d2=d1;n2=n2*n1;
r2=[5;14]*r2;
r=rtitr(n2,d2,ones(3,10));
norm(r2-r)
//
r=rtitr(n2,d2,ones(3,9),[1;1;1],[10;28]);
norm(r2(:,2:9)-r,1)
 ]]></programlisting>
        <programlisting role="example"><![CDATA[ 
//
//  State-space or transfer
a = [0.21 , 0.63 , 0.56 , 0.23 , 0.31
     0.76 , 0.85 , 0.66 , 0.23 , 0.93
     0 , 0.69 , 0.73 , 0.22 , 0.21
     0.33 , 0.88 , 0.2 , 0.88 , 0.31
     0.67 , 0.07 , 0.54 , 0.65 , 0.36];
b = [0.29 , 0.5 , 0.92
     0.57 , 0.44 , 0.04
     0.48 , 0.27 , 0.48
     0.33 , 0.63 , 0.26
     0.59 , 0.41 , 0.41];
c = [0.28 , 0.78 , 0.11 , 0.15 , 0.84
     0.13 , 0.21 , 0.69 , 0.7 , 0.41];
d = [0.41 , 0.11 , 0.56
     0.88 , 0.2 , 0.59];
s=syslin('d',a,b,c,d);
h=ss2tf(s);num=h('num');
den=h('den');
den=den(1,1)*eye(2,2);
u=1;u(3,10)=0;
r3=flts(u,s);
r=rtitr(num,den,u);
norm(r3-r,1)
 ]]></programlisting>
    </refsection>
    <refsection role="see also">
        <title>See Also</title>
        <simplelist type="inline">
            <member>
                <link linkend="ltitr">ltitr</link>
            </member>
            <member>
                <link linkend="exp">exp</link>
            </member>
            <member>
                <link linkend="flts">flts</link>
            </member>
        </simplelist>
    </refsection>
</refentry>