summaryrefslogtreecommitdiff
path: root/modules/cacsd/help/en_US/csim.xml
blob: 7ffb02e36fcb5760b6a60ac08f0fb58819082a28 (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
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
<?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="csim">
    <refnamediv>
        <refname>csim</refname>
        <refpurpose>simulation (time response) of linear system</refpurpose>
    </refnamediv>
    <refsynopsisdiv>
        <title>Calling Sequence</title>
        <synopsis>[y [,x]]=csim(u,t,sl,[x0 [,tol]])</synopsis>
    </refsynopsisdiv>
    <refsection>
        <title>Arguments</title>
        <variablelist>
            <varlistentry>
                <term>u</term>
                <listitem>
                    <para>function, list or string (control)</para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>t</term>
                <listitem>
                    <para>
                        real vector specifying times with,
                        <literal>t(1)</literal> is the initial time
                        (<literal>x0=x(t(1))</literal>).
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>sl</term>
                <listitem>
                    <para>
                        <literal>syslin</literal> list (SIMO linear system)
                        in continuous time.
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>y</term>
                <listitem>
                    <para>
                        a  matrix such that   <literal>y=[y(t(i)]</literal>, i=1,..,n
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>x</term>
                <listitem>
                    <para>
                        a  matrix such that   <literal>x=[x(t(i)]</literal>, i=1,..,n
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>tol</term>
                <listitem>
                    <para>a 2 vector [atol rtol] defining absolute and relative tolerances for ode solver (see ode)</para>
                </listitem>
            </varlistentry>
        </variablelist>
    </refsection>
    <refsection>
        <title>Description</title>
        <para>
            simulation of the controlled linear system <literal>sl</literal>.
            <literal>sl</literal> is assumed to be a continuous-time system 
            represented by a <literal>syslin</literal> list.
        </para>
        <para>
            <literal>u</literal> is the control and <literal>x0</literal> the initial state.
        </para>
        <para>
            <literal>y</literal> is the output and <literal>x</literal> the state.
        </para>
        <para>
            The control can be:
        </para>
        <para>
            1. a function : <literal>[inputs]=u(t)</literal>
        </para>
        <para>
            2. a list : <literal>list(ut,parameter1,....,parametern)</literal> such that:
            <literal>inputs=ut(t,parameter1,....,parametern)</literal> (<literal>ut</literal> is a function)
        </para>
        <para>
            3. the string <literal>"impuls"</literal> for impulse
            response calculation (here <literal>sl</literal> must have
            a single input and <literal>x0=0</literal>). For systems
            with direct feedthrough, the infinite pulse at t=0 is
            ignored.
        </para>
        <para>
            4. the string <literal>"step"</literal> for step response calculation 
            (here <literal>sl</literal>  must have a single input and
            <literal>x0=0</literal>)
        </para>
        <para>
            5. a vector giving the values of u corresponding to each t value.
        </para>
    </refsection>
    <refsection>
        <title>Examples</title>
        <programlisting role="example"><![CDATA[
s=poly(0,'s');
rand('seed',0);
w=ssrand(1,1,3);
w('A')=w('A')-2*eye();
t=0:0.05:5;
//impulse(w) = step (s * w)
plot2d([t',t'],[(csim('step',t,tf2ss(s)*w))',0*t'])
]]></programlisting>
        <scilab:image>
            s=poly(0,'s');
            rand('seed',0);
            w=ssrand(1,1,3);
            w('A')=w('A')-2*eye();
            t=0:0.05:5;
            plot2d([t',t'],[(csim('step',t,tf2ss(s)*w))',0*t'])
        </scilab:image>
        
        <programlisting role="example"><![CDATA[
s=poly(0,'s');
rand('seed',0);
w=ssrand(1,1,3);
w('A')=w('A')-2*eye();
t=0:0.05:5;
plot2d([t',t'],[(csim('impulse',t,w))',0*t'])
]]></programlisting>
        <scilab:image>
            s=poly(0,'s');
            rand('seed',0);
            w=ssrand(1,1,3);
            w('A')=w('A')-2*eye();
            t=0:0.05:5;
            plot2d([t',t'],[(csim('impulse',t,w))',0*t'])
        </scilab:image>
        <programlisting role="example"><![CDATA[
s=poly(0,'s');
rand('seed',0);
w=ssrand(1,1,3);
w('A')=w('A')-2*eye();
t=0:0.05:5;
//step(w) = impulse (s^-1 * w)
plot2d([t',t'],[(csim('step',t,w))',0*t'])
]]></programlisting>
        <scilab:image>
            s=poly(0,'s');
            rand('seed',0);
            w=ssrand(1,1,3);
            w('A')=w('A')-2*eye();
            t=0:0.05:5;
            plot2d([t',t'],[(csim('step',t,w))',0*t'])
        </scilab:image>
        <programlisting role="example"><![CDATA[
s=poly(0,'s');
rand('seed',0);
w=ssrand(1,1,3);
w('A')=w('A')-2*eye();
t=0:0.05:5;
plot2d([t',t'],[(csim('impulse',t,tf2ss(1/s)*w))',0*t'])
]]></programlisting>
        <scilab:image>
            s=poly(0,'s');
            rand('seed',0);
            w=ssrand(1,1,3);
            w('A')=w('A')-2*eye();
            t=0:0.05:5;
            plot2d([t',t'],[(csim('impulse',t,tf2ss(1/s)*w))',0*t'])
            
        </scilab:image>
        <programlisting role="example"><![CDATA[
s=poly(0,'s');
rand('seed',0);
w=ssrand(1,1,3);
w('A')=w('A')-2*eye();
t=0:0.05:5;
//input defined by a time function
deff('u=timefun(t)','u=abs(sin(t))')
clf();plot2d([t',t'],[(csim(timefun,t,w))',0*t'])
]]></programlisting>
        <scilab:image>
            s=poly(0,'s');
            rand('seed',0);
            w=ssrand(1,1,3);
            w('A')=w('A')-2*eye();
            t=0:0.05:5;
            deff('u=timefun(t)','u=abs(sin(t))')
            clf();plot2d([t',t'],[(csim(timefun,t,w))',0*t'])
        </scilab:image>
    </refsection>
    <refsection role="see also">
        <title>See Also</title>
        <simplelist type="inline">
            <member>
                <link linkend="syslin">syslin</link>
            </member>
            <member>
                <link linkend="dsimul">dsimul</link>
            </member>
            <member>
                <link linkend="flts">flts</link>
            </member>
            <member>
                <link linkend="ltitr">ltitr</link>
            </member>
            <member>
                <link linkend="rtitr">rtitr</link>
            </member>
            <member>
                <link linkend="ode">ode</link>
            </member>
            <member>
                <link linkend="impl">impl</link>
            </member>
        </simplelist>
    </refsection>
</refentry>