<?xml version="1.0" encoding="UTF-8"?>
<!--
 * Scilab ( https://www.scilab.org/ ) - This file is part of Scilab
 * Copyright (C) INRIA -
 * Copyright (C) 2012 - 2016 - Scilab Enterprises
 *
 * This file is hereby licensed under the terms of the GNU GPL v2.0,
 * pursuant to article 5.3.4 of the CeCILL v.2.1.
 * This file was originally licensed under the terms of the CeCILL v2.1,
 * and continues to be available under such terms.
 * For more information, see the COPYING file which you should have received
 * along with this program.
 *
 -->
<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="calfrq" xml:lang="en">
    <refnamediv>
        <refname>calfrq</refname>
        <refpurpose>frequency response discretization</refpurpose>
    </refnamediv>
    <refsynopsisdiv>
        <title>Syntax</title>
        <synopsis>[frq, bnds, split] = calfrq(h, fmin, fmax)</synopsis>
    </refsynopsisdiv>
    <refsection>
        <title>Arguments</title>
        <variablelist>
            <varlistentry>
                <term>h</term>
                <listitem>
                    <para>
                        A siso or simo linear dynamical system, in state
                        space, transfer function or zpk representations,
                        in continuous or discrete time.
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>fmin,fmax</term>
                <listitem>
                    <para>real scalars (min and max frequencies in Hz)</para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>frq</term>
                <listitem>
                    <para>row vector (discretization of the frequency interval)</para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>bnds</term>
                <listitem>
                    <para>
                        vector <literal>[Rmin Rmax Imin Imax]</literal> where
                        <literal>Rmin</literal> and <literal>Rmax</literal> are the lower
                        and upper bounds of the frequency response real part,
                        <literal>Imin</literal> and <literal>Imax</literal> are the lower
                        and upper bounds of the frequency response imaginary part,
                    </para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>split</term>
                <listitem>
                    <para>vector of frq splitting points indexes</para>
                </listitem>
            </varlistentry>
        </variablelist>
    </refsection>
    <refsection>
        <title>Description</title>
        <para>
            frequency response discretization; <literal>frq</literal> is the
            discretization of <literal>[fmin,fmax]</literal> such that the peaks in
            the frequency response are well represented.
        </para>
        <para>
            Singularities are located between <literal>frq(split(k)-1)</literal>
            and <literal>frq(split(k))</literal> for <literal>k&gt;1</literal>.
        </para>
    </refsection>
    <refsection>
        <title>Examples</title>
        <programlisting role="example"><![CDATA[
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))
[f1,bnds,spl]=calfrq(h1,0.01,1000);
rf=repfreq(h1,f1);
plot2d(real(rf)',imag(rf)')
 ]]></programlisting>
        <scilab:image>
            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))
            [f1,bnds,spl]=calfrq(h1,0.01,1000);
            rf=repfreq(h1,f1);
            plot2d(real(rf)',imag(rf)')
        </scilab:image>
    </refsection>
    <refsection role="see also">
        <title>See also</title>
        <simplelist type="inline">
            <member>
                <link linkend="bode">bode</link>
            </member>
            <member>
                <link linkend="black">black</link>
            </member>
            <member>
                <link linkend="nyquist">nyquist</link>
            </member>
            <member>
                <link linkend="freq">freq</link>
            </member>
            <member>
                <link linkend="repfreq">repfreq</link>
            </member>
            <member>
                <link linkend="logspace">logspace</link>
            </member>
        </simplelist>
    </refsection>
    <refsection role="history">
        <title>History</title>
        <revhistory>
            <revision>
                <revnumber>6.0</revnumber>
                <revdescription>
                    <para>handling zpk representation</para>
                </revdescription>
            </revision>
        </revhistory>
    </refsection>
</refentry>
