<!-- Converted to DocBook/SGML by Kevin Conder -->
<refentry id="GEN07">
  <refmeta>
    <refentrytitle>GEN07</refentrytitle>
  </refmeta>
 
  <refnamediv>
    <refname>GEN07</refname>
    <refpurpose>
      Constructs functions from segments of straight lines.
      <indexterm id="IndexGEN07"><primary>GEN07</primary></indexterm>
    </refpurpose>
  </refnamediv>
 
  <refsect1>
    <title>Description</title>
    <para>
      Constructs functions from segments of straight lines.
    </para>
  </refsect1>
 
  <refsect1>
    <title>Syntax</title>
    <synopsis><command>f</command>  #    time    size   7   a   n1   b   n2   c  ...</synopsis>
  </refsect1>
 
  <refsect1>
    <title>Initialization</title>
    <para>
      <emphasis>size </emphasis> -- number of points in the table. Must be a power of 2 or power-of-2 plus 1 (see <link linkend="f"><citetitle>f statement</citetitle></link>).
    </para>

    <para>
      <emphasis>a, b, c,</emphasis> etc. -- ordinate values, in odd-numbered pfields p5, p7, p9, . . .
    </para>

    <para>
      <emphasis>n1, n2</emphasis>, etc. -- length of segment (no. of storage locations), in even-numbered pfields. Cannot be negative, but a zero is meaningful for specifying discontinuous waveforms (e.g. in the example below). The sum <emphasis>n1</emphasis> + <emphasis>n2</emphasis> + .... will normally equal <emphasis>size</emphasis> for fully specified functions. If the sum is smaller, the function locations not included will be set to zero; if the sum is greater, only the first <emphasis>size</emphasis> locations will be stored.
    </para>

    <note>
      <title>Note</title>
      <para>
        <itemizedlist>
          <listitem>
            <para>
              If p4 is positive, functions are post-normalized (rescaled to a maximum absolute value of 1 after generation). A negative p4 will cause rescaling to be skipped.
            </para>
          </listitem>

          <listitem>
            <para>
              Discrete-point linear interpolation implies an increase or decrease along a segment by equal differences between adjacent locations; exponential interpolation implies that the progression is by equal ratio. In both forms the interpolation from <emphasis>a</emphasis> to <emphasis>b</emphasis> is such as to assume that the value <emphasis>b</emphasis> will be attained in the n + 1th location. For discontinuous functions, and for the segment encompassing the end location, this value will not actually be reached, although it may eventually appear as a result of final scaling.
            </para>
          </listitem>
        </itemizedlist>
      </para>
    </note>
  </refsect1>

  <refsect1>
    <title>Examples</title>
    <para>
      Here is a simple example of the GEN07 routine. It uses the files <ulink url="examples/gen07.orc"><citetitle>gen07.orc</citetitle></ulink> and <ulink url="examples/gen07.sco"><citetitle>gen07.sco</citetitle></ulink>. It will create a single-cycle sawtooth whose discontinuity is mid-way in the stored function. Here is its diagram:
      <mediaobject>
        <imageobject>
          <imagedata fileref="images/gen07.png" format="PNG">
        </imageobject>

        <textobject>
          <phrase>Diagram of the waveform generated by GEN07.</phrase>
        </textobject>

        <caption>
          <para>Diagram of the waveform generated by GEN07.</para>
        </caption>
      </mediaobject>

      <example>
        <title>A simple example of the GEN07 routine.</title>

        <programlisting>
<inlinemediaobject>
            <imageobject>
              <imagedata fileref="examples/gen07.orc" format="linespecific">
            </imageobject>
          </inlinemediaobject>
        </programlisting>

        <programlisting>
<inlinemediaobject>
            <imageobject>
              <imagedata fileref="examples/gen07.sco" format="linespecific">
            </imageobject>
          </inlinemediaobject>
        </programlisting>
      </example>
    </para>
  </refsect1>

  <refsect1>
     <title>See Also</title>
     <para>
       <link linkend="GEN05"><citetitle>GEN05</citetitle></link>,
       <link linkend="GEN06"><citetitle>GEN06</citetitle></link>, and
       <link linkend="GEN08"><citetitle>GEN08</citetitle></link>
     </para>
  </refsect1>
</refentry>
