summaryrefslogtreecommitdiffstats
path: root/scilab/modules/cacsd/help/en_US/nyquist.xml
blob: 145efdcb1e12fbc538d2ab657eb91f0b588c9444 (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
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
<?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-en.txt
*
-->
<refentry version="5.0-subset Scilab" xml:id="nyquist" xml:lang="en"
          xmlns="http://docbook.org/ns/docbook"
          xmlns:xlink="http://www.w3.org/1999/xlink"
          xmlns:svg="http://www.w3.org/2000/svg"
          xmlns:ns5="http://www.w3.org/1999/xhtml"
          xmlns:mml="http://www.w3.org/1998/Math/MathML"
          xmlns:db="http://docbook.org/ns/docbook">
  <info>
    <pubdate>$LastChangedDate: 2008-03-26 09:50:39 +0100 (Wed, 26 Mar 2008)
    $</pubdate>
  </info>

  <refnamediv>
    <refname>nyquist</refname>

    <refpurpose>nyquist plot</refpurpose>
  </refnamediv>

  <refsynopsisdiv>
    <title>Calling Sequence</title>

    <synopsis>
      nyquist( sl,[fmin,fmax] [,step] [,comments] )
      nyquist( sl, frq [,comments] )
      nyquist(frq,db,phi [,comments])
      nyquist(frq, repf [,comments])
    </synopsis>
  </refsynopsisdiv>

  <refsection>
    <title>Parameters</title>

    <variablelist>
      <varlistentry>
        <term>sl</term>

        <listitem>
          <para> a continuous or discrete time SIMO linear dynamical system ( see: <link linkend="syslin">syslin</link>).</para>
        </listitem>
      </varlistentry>

      <varlistentry>
        <term>fmin,fmax</term>

        <listitem>
          <para>real scalars (frequency bounds (in Hz))</para>
        </listitem>
      </varlistentry>

      <varlistentry>
        <term>step</term>

        <listitem>
          <para>real (logarithmic discretization step)</para>
        </listitem>
      </varlistentry>

      <varlistentry>
        <term>comments</term>

        <listitem>
          <para>string vector (captions).</para>
        </listitem>
      </varlistentry>

      <varlistentry>
        <term>frq</term>

        <listitem>
          <para>vector or matrix of frequencies (in Hz) (one row for each
          output of <literal>sl</literal>).</para>
        </listitem>
      </varlistentry>

      <varlistentry>
        <term>db,phi</term>

        <listitem>
          <para>real matrices of modulus (in dB) and phases (in degree) (one
          row for each output of <literal>sl</literal>).</para>
        </listitem>
      </varlistentry>

      <varlistentry>
        <term>repf</term>

        <listitem>
          <para>matrix of complex numbers. Frequency response (one row for
          aech output of <literal>sl</literal>)</para>
        </listitem>
      </varlistentry>
    </variablelist>
  </refsection>

  <refsection>
    <title>Description</title>

    <para>Nyquist plot i.e Imaginary part versus Real part of the frequency
    response of <literal>sl</literal>.</para>

    <para>For continuous time systems <literal>sl(2*%i*%pi*w)</literal> is
    plotted. For discrete time system or discretized systems
    <literal>sl(exp(2*%i*%pi*w*fd)</literal> is used ( <literal>fd=1</literal>
    for discrete time systems and <literal>fd=sl('dt')</literal> for
    discretized systems )</para>

    <para><literal>sl</literal> can be a continuous-time or discrete-time SIMO
    system (see <literal>syslin</literal>). In case of multi-output the
    outputs are plotted with different symbols.</para>

    <para>The frequencies are given by the bounds <literal>fmin,fmax</literal>
    (in Hz) or by a row-vector (or a matrix for multi-output)
    <literal>frq</literal>.</para>

    <para><literal>step</literal> is the ( logarithmic ) discretization step.
    (see <literal>calfrq</literal> for the choice of default value).</para>

    <para><literal>comments</literal> is a vector of character strings
    (captions).</para>

    <para><literal>db,phi</literal> are the matrices of modulus (in Db) and
    phases (in degrees). (One row for each response).</para>

    <para><literal>repf</literal> is a matrix of complex numbers. One row for
    each response.</para>

    <para>Default values for <literal>fmin</literal> and
    <literal>fmax</literal> are <literal>1.d-3</literal>,
    <literal>1.d+3</literal> if <literal>sl</literal> is continuous-time or
    <literal>1.d-3</literal>, <literal>0.5</literal>/sl.dt (nyquist frequency)
    if <literal>sl</literal> is discrete-time.</para>

    <para>Automatic discretization of frequencies is made by
    <link linkend="calfrq">calfrq</link>.</para>
    <para>To obtain the value of the frequency at a selected point(s) you can
    activate the <link linkend="datatips">datatips</link> manager and
    click the desired point on the nyquist curve(s).
    </para>
  </refsection>
  <refsection>
    <title>Graphics entities organization</title>
    <para>
      The <literal>nyquist</literal> function creates a compound
      object for each SISO system. The following piece of code allows
      to get the handle on the compound object of the ith system:
    </para>
    <programlisting role="getcompound"><![CDATA[
    ax=gca();//handle on current axes
    hi=ax.children($+i-1)// the handle on the compound object of the ith system
    ]]></programlisting>
    <para>
      This compound object has two children: a compound object that
      defines the small arrows (a compound of small polylines)  and the curve labels  (a compound of texts)  and a polyline
      which is the curve itself. The following piece of code shows how
      one can customize a particular nyquist curve display.
    </para>
    <programlisting role="customize"><![CDATA[
    hi.children(1).visible='off'; //hides the arrows and labels
    hi.children(2).thickness=2; //make the curve thicker

    ]]></programlisting>

  </refsection>
  <refsection>
    <title>Examples</title>
    <programlisting role="example"><![CDATA[
    //Nyquist curve
    s=poly(0,'s')
    h=syslin('c',(s^2+2*0.9*10*s+100)/(s^2+2*0.3*10.1*s+102.01));
    h1=h*syslin('c',(s^2+2*0.1*15.1*s+228.01)/(s^2+2*0.9*15*s+225))
    clf();    nyquist(h1)
    // add a datatip
    ax=gca();
    h_h=ax.children($).children(2);//handle on Nyquist curve of h
    tip=datatipCreate(h_h,[1.331,0.684]);
    datatipSetOrientation(tip,"upper left");
    ]]></programlisting>
    <para>
      <inlinemediaobject>
        <imageobject>
          <imagedata fileref="../images/nyquist.svg"/>
        </imageobject>
      </inlinemediaobject>
    </para>
    <programlisting role="example"><![CDATA[
    //Hall chart as a grid for nyquist
    s=poly(0,'s');
    Plant=syslin('c',16000/((s+1)*(s+10)*(s+100)));
    //two degree of freedom PID
    tau=0.2;xsi=1.2;
    PID=syslin('c',(1/(2*xsi*tau*s))*(1+2*xsi*tau*s+tau^2*s^2));
    clf();
    nyquist([Plant;Plant*PID],0.5,100,["Plant";"Plant and PID corrector"]);
    hallchart(colors=color('light gray')*[1 1])
    //move the caption in the lower rigth corner
    ax=gca();Leg=ax.children(1);
    Leg.legend_location="in_upper_left";
    ]]></programlisting>
    <para>
      <inlinemediaobject>
        <imageobject>
          <imagedata fileref="../images/nyquist2.svg"/>
        </imageobject>
      </inlinemediaobject>
    </para>
  </refsection>

  <refsection>
    <title>See Also</title>

    <simplelist type="inline">
      <member>
        <link linkend="syslin">syslin</link>
      </member>

      <member><link linkend="bode">bode</link></member>

      <member><link linkend="black">black</link></member>

      <member><link linkend="calfrq">calfrq</link></member>

      <member><link linkend="freq">freq</link></member>

      <member><link linkend="repfreq">repfreq</link></member>

      <member><link linkend="phasemag">phasemag</link></member>
      <member>
        <link linkend="datatips">datatips</link>
      </member>

    </simplelist>
  </refsection>
</refentry>