Sophie

Sophie

distrib > Mandriva > current > x86_64 > by-pkgid > a3a677d80d3c0f62bd8cfbb738fb1e85 > files > 367

octave-doc-3.2.4-1mdv2010.1.x86_64.rpm

<html lang="en">
<head>
<title>Signal Processing - Untitled</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Untitled">
<meta name="generator" content="makeinfo 4.13">
<link title="Top" rel="start" href="index.html#Top">
<link rel="prev" href="Geometry.html#Geometry" title="Geometry">
<link rel="next" href="Image-Processing.html#Image-Processing" title="Image Processing">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
  pre.display { font-family:inherit }
  pre.format  { font-family:inherit }
  pre.smalldisplay { font-family:inherit; font-size:smaller }
  pre.smallformat  { font-family:inherit; font-size:smaller }
  pre.smallexample { font-size:smaller }
  pre.smalllisp    { font-size:smaller }
  span.sc    { font-variant:small-caps }
  span.roman { font-family:serif; font-weight:normal; } 
  span.sansserif { font-family:sans-serif; font-weight:normal; } 
--></style>
</head>
<body>
<div class="node">
<a name="Signal-Processing"></a>
<p>
Next:&nbsp;<a rel="next" accesskey="n" href="Image-Processing.html#Image-Processing">Image Processing</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Geometry.html#Geometry">Geometry</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="index.html#Top">Top</a>
<hr>
</div>

<h2 class="chapter">30 Signal Processing</h2>

<p>This chapter describes the signal processing and fast Fourier
transform functions available in Octave.  Fast Fourier transforms are
computed with the <span class="sc">fftw</span> or <span class="sc">fftpack</span> libraries depending on how
Octave is built.

<!-- ./signal/detrend.m -->
   <p><a name="doc_002ddetrend"></a>

<div class="defun">
&mdash; Function File:  <b>detrend</b> (<var>x, p</var>)<var><a name="index-detrend-2122"></a></var><br>
<blockquote><p>If <var>x</var> is a vector, <code>detrend (</code><var>x</var><code>, </code><var>p</var><code>)</code> removes the
best fit of a polynomial of order <var>p</var> from the data <var>x</var>.

        <p>If <var>x</var> is a matrix, <code>detrend (</code><var>x</var><code>, </code><var>p</var><code>)</code> does the same
for each column in <var>x</var>.

        <p>The second argument is optional.  If it is not specified, a value of 1
is assumed.  This corresponds to removing a linear trend. 
</p></blockquote></div>

<!-- ./DLD-FUNCTIONS/fft.cc -->
   <p><a name="doc_002dfft"></a>

<div class="defun">
&mdash; Loadable Function:  <b>fft</b> (<var>a, n, dim</var>)<var><a name="index-fft-2123"></a></var><br>
<blockquote><p>Compute the FFT of <var>a</var> using subroutines from
<span class="sc">fftw</span>.  The FFT is calculated along the first non-singleton dimension of the
array.  Thus if <var>a</var> is a matrix, <code>fft (</code><var>a</var><code>)</code> computes the
FFT for each column of <var>a</var>.

        <p>If called with two arguments, <var>n</var> is expected to be an integer
specifying the number of elements of <var>a</var> to use, or an empty
matrix to specify that its value should be ignored.  If <var>n</var> is
larger than the dimension along which the FFT is calculated, then
<var>a</var> is resized and padded with zeros.  Otherwise, if <var>n</var> is
smaller than the dimension along which the FFT is calculated, then
<var>a</var> is truncated.

        <p>If called with three arguments, <var>dim</var> is an integer specifying the
dimension of the matrix along which the FFT is performed
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->

     <p class="noindent"><strong>See also:</strong> <a href="doc_002difft.html#doc_002difft">ifft</a>, <a href="doc_002dfft2.html#doc_002dfft2">fft2</a>, <a href="doc_002dfftn.html#doc_002dfftn">fftn</a>, <a href="doc_002dfftw.html#doc_002dfftw">fftw</a>. 
</p></blockquote></div>

   <p>Octave uses the <span class="sc">fftw</span> libraries to perform FFT computations.  When Octave
starts up and initializes the <span class="sc">fftw</span> libraries, they read a system wide
file (on a Unix system, it is typically <samp><span class="file">/etc/fftw/wisdom</span></samp>) that
contains information useful to speed up FFT computations.  This
information is called the <em>wisdom</em>.  The system-wide file allows
wisdom to be shared between all applications using the <span class="sc">fftw</span> libraries.

   <p>Use the <code>fftw</code> function to generate and save wisdom.  Using the
utilities provided together with the <span class="sc">fftw</span> libraries
(<samp><span class="command">fftw-wisdom</span></samp> on Unix systems), you can even add wisdom
generated by Octave to the system-wide wisdom file.

<!-- ./DLD-FUNCTIONS/fftw.cc -->
   <p><a name="doc_002dfftw"></a>

<div class="defun">
&mdash; Loadable Function: <var>method</var> = <b>fftw</b> (<var>'planner'</var>)<var><a name="index-fftw-2124"></a></var><br>
&mdash; Loadable Function:  <b>fftw</b> (<var>'planner', method</var>)<var><a name="index-fftw-2125"></a></var><br>
&mdash; Loadable Function: <var>wisdom</var> = <b>fftw</b> (<var>'dwisdom'</var>)<var><a name="index-fftw-2126"></a></var><br>
&mdash; Loadable Function: <var>wisdom</var> = <b>fftw</b> (<var>'dwisdom', wisdom</var>)<var><a name="index-fftw-2127"></a></var><br>
<blockquote>
        <p>Manage <span class="sc">fftw</span> wisdom data.  Wisdom data can be used to significantly
accelerate the calculation of the FFTs but implies an initial cost
in its calculation.  When the <span class="sc">fftw</span> libraries are initialized, they read
a system wide wisdom file (typically in <samp><span class="file">/etc/fftw/wisdom</span></samp>), allowing wisdom
to be shared between applications other than Octave.  Alternatively, the
<code>fftw</code> function can be used to import wisdom.  For example

     <pre class="example">          <var>wisdom</var> = fftw ('dwisdom')
</pre>
        <p>will save the existing wisdom used by Octave to the string <var>wisdom</var>. 
This string can then be saved to a file and restored using the <code>save</code>
and <code>load</code> commands respectively.  This existing wisdom can be reimported
as follows

     <pre class="example">          fftw ('dwisdom', <var>wisdom</var>)
</pre>
        <p>If <var>wisdom</var> is an empty matrix, then the wisdom used is cleared.

        <p>During the calculation of Fourier transforms further wisdom is generated. 
The fashion in which this wisdom is generated is equally controlled by
the <code>fftw</code> function.  There are five different manners in which the
wisdom can be treated, these being

          <dl>
<dt>'estimate'<dd>This specifies that no run-time measurement of the optimal means of
calculating a particular is performed, and a simple heuristic is used
to pick a (probably sub-optimal) plan.  The advantage of this method is
that there is little or no overhead in the generation of the plan, which
is appropriate for a Fourier transform that will be calculated once.

          <br><dt>'measure'<dd>In this case a range of algorithms to perform the transform is considered
and the best is selected based on their execution time.

          <br><dt>'patient'<dd>This is like 'measure', but a wider range of algorithms is considered.

          <br><dt>'exhaustive'<dd>This is like 'measure', but all possible algorithms that may be used to
treat the transform are considered.

          <br><dt>'hybrid'<dd>As run-time measurement of the algorithm can be expensive, this is a
compromise where 'measure' is used for transforms up to the size of 8192
and beyond that the 'estimate' method is used. 
</dl>

        <p>The default method is 'estimate', and the method currently being used can
be probed with

     <pre class="example">          <var>method</var> = fftw ('planner')
</pre>
        <p>and the method used can be set using

     <pre class="example">          fftw ('planner', <var>method</var>)
</pre>
        <p>Note that calculated wisdom will be lost when restarting Octave.  However,
the wisdom data can be reloaded if it is saved to a file as described
above.  Saved wisdom files should not be used on different platforms since
they will not be efficient and the point of calculating the wisdom is lost. 
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->

     <p class="noindent"><strong>See also:</strong> <a href="doc_002dfft.html#doc_002dfft">fft</a>, <a href="doc_002difft.html#doc_002difft">ifft</a>, <a href="doc_002dfft2.html#doc_002dfft2">fft2</a>, <a href="doc_002difft2.html#doc_002difft2">ifft2</a>, <a href="doc_002dfftn.html#doc_002dfftn">fftn</a>, <a href="doc_002difftn.html#doc_002difftn">ifftn</a>. 
</p></blockquote></div>

<!-- ./DLD-FUNCTIONS/fft.cc -->
   <p><a name="doc_002difft"></a>

<div class="defun">
&mdash; Loadable Function:  <b>ifft</b> (<var>a, n, dim</var>)<var><a name="index-ifft-2128"></a></var><br>
<blockquote><p>Compute the inverse FFT of <var>a</var> using subroutines from
<span class="sc">fftw</span>.  The inverse FFT is calculated along the first non-singleton dimension
of the array.  Thus if <var>a</var> is a matrix, <code>fft (</code><var>a</var><code>)</code> computes
the inverse FFT for each column of <var>a</var>.

        <p>If called with two arguments, <var>n</var> is expected to be an integer
specifying the number of elements of <var>a</var> to use, or an empty
matrix to specify that its value should be ignored.  If <var>n</var> is
larger than the dimension along which the inverse FFT is calculated, then
<var>a</var> is resized and padded with zeros.  Otherwise, if<var>n</var> is
smaller than the dimension along which the inverse FFT is calculated,
then <var>a</var> is truncated.

        <p>If called with three arguments, <var>dim</var> is an integer specifying the
dimension of the matrix along which the inverse FFT is performed
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->

     <p class="noindent"><strong>See also:</strong> <a href="doc_002dfft.html#doc_002dfft">fft</a>, <a href="doc_002difft2.html#doc_002difft2">ifft2</a>, <a href="doc_002difftn.html#doc_002difftn">ifftn</a>, <a href="doc_002dfftw.html#doc_002dfftw">fftw</a>. 
</p></blockquote></div>

<!-- ./DLD-FUNCTIONS/fft2.cc -->
   <p><a name="doc_002dfft2"></a>

<div class="defun">
&mdash; Loadable Function:  <b>fft2</b> (<var>a, n, m</var>)<var><a name="index-fft2-2129"></a></var><br>
<blockquote><p>Compute the two-dimensional FFT of <var>a</var> using subroutines from
<span class="sc">fftw</span>.  The optional arguments <var>n</var> and <var>m</var> may be used specify the
number of rows and columns of <var>a</var> to use.  If either of these is
larger than the size of <var>a</var>, <var>a</var> is resized and padded with
zeros.

        <p>If <var>a</var> is a multi-dimensional matrix, each two-dimensional sub-matrix
of <var>a</var> is treated separately
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->

     <p class="noindent"><strong>See also:</strong> ifft2, fft, fftn, fftw. 
</p></blockquote></div>

<!-- ./DLD-FUNCTIONS/fft2.cc -->
   <p><a name="doc_002difft2"></a>

<div class="defun">
&mdash; Loadable Function:  <b>fft2</b> (<var>a, n, m</var>)<var><a name="index-fft2-2130"></a></var><br>
<blockquote><p>Compute the inverse two-dimensional FFT of <var>a</var> using subroutines from
<span class="sc">fftw</span>.  The optional arguments <var>n</var> and <var>m</var> may be used specify the
number of rows and columns of <var>a</var> to use.  If either of these is
larger than the size of <var>a</var>, <var>a</var> is resized and padded with
zeros.

        <p>If <var>a</var> is a multi-dimensional matrix, each two-dimensional sub-matrix
of <var>a</var> is treated separately
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->

     <p class="noindent"><strong>See also:</strong> fft2, ifft, ifftn, fftw. 
</p></blockquote></div>

<!-- ./DLD-FUNCTIONS/fftn.cc -->
   <p><a name="doc_002dfftn"></a>

<div class="defun">
&mdash; Loadable Function:  <b>fftn</b> (<var>a, size</var>)<var><a name="index-fftn-2131"></a></var><br>
<blockquote><p>Compute the N-dimensional FFT of <var>a</var> using subroutines from
<span class="sc">fftw</span>.  The optional vector argument <var>size</var> may be used specify the
dimensions of the array to be used.  If an element of <var>size</var> is
smaller than the corresponding dimension, then the dimension is
truncated prior to performing the FFT.  Otherwise if an element
of <var>size</var> is larger than the corresponding dimension <var>a</var>
is resized and padded with zeros. 
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->

     <p class="noindent"><strong>See also:</strong> ifftn, fft, fft2, fftw. 
</p></blockquote></div>

<!-- ./DLD-FUNCTIONS/fftn.cc -->
   <p><a name="doc_002difftn"></a>

<div class="defun">
&mdash; Loadable Function:  <b>ifftn</b> (<var>a, size</var>)<var><a name="index-ifftn-2132"></a></var><br>
<blockquote><p>Compute the inverse N-dimensional FFT of <var>a</var> using subroutines from
<span class="sc">fftw</span>.  The optional vector argument <var>size</var> may be used specify the
dimensions of the array to be used.  If an element of <var>size</var> is
smaller than the corresponding dimension, then the dimension is
truncated prior to performing the inverse FFT.  Otherwise if an element
of <var>size</var> is larger than the corresponding dimension <var>a</var>
is resized and padded with zeros. 
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->

     <p class="noindent"><strong>See also:</strong> fftn, ifft, ifft2, fftw. 
</p></blockquote></div>

<!-- ./signal/fftconv.m -->
   <p><a name="doc_002dfftconv"></a>

<div class="defun">
&mdash; Function File:  <b>fftconv</b> (<var>a, b, n</var>)<var><a name="index-fftconv-2133"></a></var><br>
<blockquote><p>Return the convolution of the vectors <var>a</var> and <var>b</var>, as a vector
with length equal to the <code>length (a) + length (b) - 1</code>.  If <var>a</var>
and <var>b</var> are the coefficient vectors of two polynomials, the returned
value is the coefficient vector of the product polynomial.

        <p>The computation uses the FFT by calling the function <code>fftfilt</code>.  If
the optional argument <var>n</var> is specified, an N-point FFT is used. 
</p></blockquote></div>

<!-- ./signal/fftfilt.m -->
   <p><a name="doc_002dfftfilt"></a>

<div class="defun">
&mdash; Function File:  <b>fftfilt</b> (<var>b, x, n</var>)<var><a name="index-fftfilt-2134"></a></var><br>
<blockquote>
        <p>With two arguments, <code>fftfilt</code> filters <var>x</var> with the FIR filter
<var>b</var> using the FFT.

        <p>Given the optional third argument, <var>n</var>, <code>fftfilt</code> uses the
overlap-add method to filter <var>x</var> with <var>b</var> using an N-point FFT.

        <p>If <var>x</var> is a matrix, filter each column of the matrix. 
</p></blockquote></div>

<!-- ./DLD-FUNCTIONS/filter.cc -->
   <p><a name="doc_002dfilter"></a>

<div class="defun">
&mdash; Loadable Function: y = <b>filter</b> (<var>b, a, x</var>)<var><a name="index-filter-2135"></a></var><br>
&mdash; Loadable Function: [<var>y</var>, <var>sf</var>] = <b>filter</b> (<var>b, a, x, si</var>)<var><a name="index-filter-2136"></a></var><br>
&mdash; Loadable Function: [<var>y</var>, <var>sf</var>] = <b>filter</b> (<var>b, a, x, </var>[]<var>, dim</var>)<var><a name="index-filter-2137"></a></var><br>
&mdash; Loadable Function: [<var>y</var>, <var>sf</var>] = <b>filter</b> (<var>b, a, x, si, dim</var>)<var><a name="index-filter-2138"></a></var><br>
<blockquote><p>Return the solution to the following linear, time-invariant difference
equation:

     <!-- Set example in small font to prevent overfull line -->
     <pre class="smallexample">             N                   M
            SUM a(k+1) y(n-k) = SUM b(k+1) x(n-k)      for 1&lt;=n&lt;=length(x)
            k=0                 k=0
</pre>
        <p class="noindent">where
 N=length(a)-1 and M=length(b)-1. 
over the first non-singleton dimension of <var>x</var> or over <var>dim</var> if
supplied.  An equivalent form of this equation is:

     <!-- Set example in small font to prevent overfull line -->
     <pre class="smallexample">                      N                   M
            y(n) = - SUM c(k+1) y(n-k) + SUM d(k+1) x(n-k)  for 1&lt;=n&lt;=length(x)
                     k=1                 k=0
</pre>
        <p class="noindent">where
 c = a/a(1) and d = b/a(1).

        <p>If the fourth argument <var>si</var> is provided, it is taken as the
initial state of the system and the final state is returned as
<var>sf</var>.  The state vector is a column vector whose length is
equal to the length of the longest coefficient vector minus one. 
If <var>si</var> is not supplied, the initial state vector is set to all
zeros.

        <p>In terms of the z-transform, y is the result of passing the discrete-
time signal x through a system characterized by the following rational
system function:

     <pre class="example">                       M
                      SUM d(k+1) z^(-k)
                      k=0
            H(z) = ----------------------
                         N
                    1 + SUM c(k+1) z^(-k)
                        k=1
</pre>
        </blockquote></div>

<!-- ./signal/filter2.m -->
   <p><a name="doc_002dfilter2"></a>

<div class="defun">
&mdash; Function File: <var>y</var> = <b>filter2</b> (<var>b, x</var>)<var><a name="index-filter2-2139"></a></var><br>
&mdash; Function File: <var>y</var> = <b>filter2</b> (<var>b, x, shape</var>)<var><a name="index-filter2-2140"></a></var><br>
<blockquote><p>Apply the 2-D FIR filter <var>b</var> to <var>x</var>.  If the argument
<var>shape</var> is specified, return an array of the desired shape. 
Possible values are:

          <dl>
<dt>'full'<dd>pad <var>x</var> with zeros on all sides before filtering. 
<br><dt>'same'<dd>unpadded <var>x</var> (default)
<br><dt>'valid'<dd>trim <var>x</var> after filtering so edge effects are no included. 
</dl>

        <p>Note this is just a variation on convolution, with the parameters
reversed and <var>b</var> rotated 180 degrees. 
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->

     <p class="noindent"><strong>See also:</strong> <a href="doc_002dconv2.html#doc_002dconv2">conv2</a>. 
</p></blockquote></div>

<!-- ./signal/freqz.m -->
   <p><a name="doc_002dfreqz"></a>

<div class="defun">
&mdash; Function File: [<var>h</var>, <var>w</var>] = <b>freqz</b> (<var>b, a, n, "whole"</var>)<var><a name="index-freqz-2141"></a></var><br>
<blockquote><p>Return the complex frequency response <var>h</var> of the rational IIR filter
whose numerator and denominator coefficients are <var>b</var> and <var>a</var>,
respectively.  The response is evaluated at <var>n</var> angular frequencies
between 0 and
 2*pi.

     <p class="noindent">The output value <var>w</var> is a vector of the frequencies.

        <p>If the fourth argument is omitted, the response is evaluated at
frequencies between 0 and
 pi.

        <p>If <var>n</var> is omitted, a value of 512 is assumed.

        <p>If <var>a</var> is omitted, the denominator is assumed to be 1 (this
corresponds to a simple FIR filter).

        <p>For fastest computation, <var>n</var> should factor into a small number of
small primes.

   &mdash; Function File: <var>h</var> = <b>freqz</b> (<var>b, a, w</var>)<var><a name="index-freqz-2142"></a></var><br>
<blockquote><p>Evaluate the response at the specific frequencies in the vector <var>w</var>. 
The values for <var>w</var> are measured in radians.

   &mdash; Function File: [<small class="dots">...</small>] = <b>freqz</b> (<var><small class="dots">...</small>, Fs</var>)<var><a name="index-freqz-2143"></a></var><br>
<blockquote><p>Return frequencies in Hz instead of radians assuming a sampling rate
<var>Fs</var>.  If you are evaluating the response at specific frequencies
<var>w</var>, those frequencies should be requested in Hz rather than radians.

   &mdash; Function File:  <b>freqz</b> (<var><small class="dots">...</small></var>)<var><a name="index-freqz-2144"></a></var><br>
<blockquote><p>Plot the pass band, stop band and phase response of <var>h</var> rather
than returning them. 
</p></blockquote></div>

<!-- ./signal/freqz_plot.m -->
   <p><a name="doc_002dfreqz_005fplot"></a>

<div class="defun">
&mdash; Function File:  <b>freqz_plot</b> (<var>w, h</var>)<var><a name="index-freqz_005fplot-2145"></a></var><br>
<blockquote><p>Plot the pass band, stop band and phase response of <var>h</var>. 
</p></blockquote></div>

<!-- ./signal/sinc.m -->
   <p><a name="doc_002dsinc"></a>

<div class="defun">
&mdash; Function File:  <b>sinc</b> (<var>x</var>)<var><a name="index-sinc-2146"></a></var><br>
<blockquote><p>Return
 sin(pi*x)/(pi*x). 
</p></blockquote></div>

<!-- ./signal/unwrap.m -->
   <p><a name="doc_002dunwrap"></a>

<div class="defun">
&mdash; Function File: <var>b</var> = <b>unwrap</b> (<var>a, tol, dim</var>)<var><a name="index-unwrap-2147"></a></var><br>
<blockquote>
        <p>Unwrap radian phases by adding multiples of 2*pi as appropriate to
remove jumps greater than <var>tol</var>.  <var>tol</var> defaults to pi.

        <p>Unwrap will unwrap along the first non-singleton dimension of
<var>a</var>, unless the optional argument <var>dim</var> is given, in
which case the data will be unwrapped along this dimension
</p></blockquote></div>

<!-- FIXME - someone needs to organize these... -->
<!-- ./signal/arch_fit.m -->
   <p><a name="doc_002darch_005ffit"></a>

<div class="defun">
&mdash; Function File: [<var>a</var>, <var>b</var>] = <b>arch_fit</b> (<var>y, x, p, iter, gamma, a0, b0</var>)<var><a name="index-arch_005ffit-2148"></a></var><br>
<blockquote><p>Fit an ARCH regression model to the time series <var>y</var> using the
scoring algorithm in Engle's original ARCH paper.  The model is

     <pre class="example">          y(t) = b(1) * x(t,1) + ... + b(k) * x(t,k) + e(t),
          h(t) = a(1) + a(2) * e(t-1)^2 + ... + a(p+1) * e(t-p)^2
</pre>
        <p class="noindent">in which e(t) is N(0, h(t)), given a time-series vector
<var>y</var> up to time t-1 and a matrix of (ordinary) regressors
<var>x</var> up to t.  The order of the regression of the residual
variance is specified by <var>p</var>.

        <p>If invoked as <code>arch_fit (</code><var>y</var><code>, </code><var>k</var><code>, </code><var>p</var><code>)</code> with a
positive integer <var>k</var>, fit an ARCH(<var>k</var>, <var>p</var>) process,
i.e., do the above with the t-th row of <var>x</var> given by

     <pre class="example">          [1, y(t-1), ..., y(t-k)]
</pre>
        <p>Optionally, one can specify the number of iterations <var>iter</var>, the
updating factor <var>gamma</var>, and initial values a0 and
b0 for the scoring algorithm. 
</p></blockquote></div>

<!-- ./signal/arch_rnd.m -->
   <p><a name="doc_002darch_005frnd"></a>

<div class="defun">
&mdash; Function File:  <b>arch_rnd</b> (<var>a, b, t</var>)<var><a name="index-arch_005frnd-2149"></a></var><br>
<blockquote><p>Simulate an ARCH sequence of length <var>t</var> with AR
coefficients <var>b</var> and CH coefficients <var>a</var>.  I.e., the result
y(t) follows the model

     <!-- Set example in small font to prevent overfull line -->
     <pre class="smallexample">          y(t) = b(1) + b(2) * y(t-1) + ... + b(lb) * y(t-lb+1) + e(t),
</pre>
        <p class="noindent">where e(t), given <var>y</var> up to time t-1, is
N(0, h(t)), with

     <!-- Set example in small font to prevent overfull line -->
     <pre class="smallexample">          h(t) = a(1) + a(2) * e(t-1)^2 + ... + a(la) * e(t-la+1)^2
</pre>
        </blockquote></div>

<!-- ./signal/arch_test.m -->
   <p><a name="doc_002darch_005ftest"></a>

<div class="defun">
&mdash; Function File: [<var>pval</var>, <var>lm</var>] = <b>arch_test</b> (<var>y, x, p</var>)<var><a name="index-arch_005ftest-2150"></a></var><br>
<blockquote><p>For a linear regression model

     <pre class="example">          y = x * b + e
</pre>
        <p class="noindent">perform a Lagrange Multiplier (LM) test of the null hypothesis of no
conditional heteroscedascity against the alternative of CH(<var>p</var>).

        <p>I.e., the model is

     <pre class="example">          y(t) = b(1) * x(t,1) + ... + b(k) * x(t,k) + e(t),
</pre>
        <p class="noindent">given <var>y</var> up to t-1 and <var>x</var> up to t,
e(t) is N(0, h(t)) with

     <pre class="example">          h(t) = v + a(1) * e(t-1)^2 + ... + a(p) * e(t-p)^2,
</pre>
        <p class="noindent">and the null is a(1) == <small class="dots">...</small> == a(p) == 0.

        <p>If the second argument is a scalar integer, k, perform the same
test in a linear autoregression model of order k, i.e., with

     <pre class="example">          [1, y(t-1), ..., y(t-<var>k</var>)]
</pre>
        <p class="noindent">as the t-th row of <var>x</var>.

        <p>Under the null, LM approximately has a chisquare distribution with
<var>p</var> degrees of freedom and <var>pval</var> is the p-value (1
minus the CDF of this distribution at LM) of the test.

        <p>If no output argument is given, the p-value is displayed. 
</p></blockquote></div>

<!-- ./signal/arma_rnd.m -->
   <p><a name="doc_002darma_005frnd"></a>

<div class="defun">
&mdash; Function File:  <b>arma_rnd</b> (<var>a, b, v, t, n</var>)<var><a name="index-arma_005frnd-2151"></a></var><br>
<blockquote><p>Return a simulation of the ARMA model

     <pre class="example">          x(n) = a(1) * x(n-1) + ... + a(k) * x(n-k)
               + e(n) + b(1) * e(n-1) + ... + b(l) * e(n-l)
</pre>
        <p class="noindent">in which <var>k</var> is the length of vector <var>a</var>, <var>l</var> is the
length of vector <var>b</var> and <var>e</var> is Gaussian white noise with
variance <var>v</var>.  The function returns a vector of length <var>t</var>.

        <p>The optional parameter <var>n</var> gives the number of dummy
<var>x</var>(<var>i</var>) used for initialization, i.e., a sequence of length
<var>t</var>+<var>n</var> is generated and <var>x</var>(<var>n</var>+1:<var>t</var>+<var>n</var>)
is returned.  If <var>n</var> is omitted, <var>n</var> = 100 is used. 
</p></blockquote></div>

<!-- ./signal/autocor.m -->
   <p><a name="doc_002dautocor"></a>

<div class="defun">
&mdash; Function File:  <b>autocor</b> (<var>x, h</var>)<var><a name="index-autocor-2152"></a></var><br>
<blockquote><p>Return the autocorrelations from lag 0 to <var>h</var> of vector <var>x</var>. 
If <var>h</var> is omitted, all autocorrelations are computed. 
If <var>x</var> is a matrix, the autocorrelations of each column are
computed. 
</p></blockquote></div>

<!-- ./signal/autocov.m -->
   <p><a name="doc_002dautocov"></a>

<div class="defun">
&mdash; Function File:  <b>autocov</b> (<var>x, h</var>)<var><a name="index-autocov-2153"></a></var><br>
<blockquote><p>Return the autocovariances from lag 0 to <var>h</var> of vector <var>x</var>. 
If <var>h</var> is omitted, all autocovariances are computed. 
If <var>x</var> is a matrix, the autocovariances of each column are
computed. 
</p></blockquote></div>

<!-- ./signal/autoreg_matrix.m -->
   <p><a name="doc_002dautoreg_005fmatrix"></a>

<div class="defun">
&mdash; Function File:  <b>autoreg_matrix</b> (<var>y, k</var>)<var><a name="index-autoreg_005fmatrix-2154"></a></var><br>
<blockquote><p>Given a time series (vector) <var>y</var>, return a matrix with ones in the
first column and the first <var>k</var> lagged values of <var>y</var> in the
other columns.  I.e., for <var>t</var> &gt; <var>k</var>, <code>[1,
</code><var>y</var><code>(</code><var>t</var><code>-1), ..., </code><var>y</var><code>(</code><var>t</var><code>-</code><var>k</var><code>)]</code> is the t-th row
of the result.  The resulting matrix may be used as a regressor matrix
in autoregressions. 
</p></blockquote></div>

<!-- ./signal/bartlett.m -->
   <p><a name="doc_002dbartlett"></a>

<div class="defun">
&mdash; Function File:  <b>bartlett</b> (<var>m</var>)<var><a name="index-bartlett-2155"></a></var><br>
<blockquote><p>Return the filter coefficients of a Bartlett (triangular) window of
length <var>m</var>.

        <p>For a definition of the Bartlett window, see e.g., A. V. Oppenheim &amp;
R. W. Schafer, <cite>Discrete-Time Signal Processing</cite>. 
</p></blockquote></div>

<!-- ./signal/blackman.m -->
   <p><a name="doc_002dblackman"></a>

<div class="defun">
&mdash; Function File:  <b>blackman</b> (<var>m</var>)<var><a name="index-blackman-2156"></a></var><br>
<blockquote><p>Return the filter coefficients of a Blackman window of length <var>m</var>.

        <p>For a definition of the Blackman window, see e.g., A. V. Oppenheim &amp;
R. W. Schafer, <cite>Discrete-Time Signal Processing</cite>. 
</p></blockquote></div>

<!-- ./signal/diffpara.m -->
   <p><a name="doc_002ddiffpara"></a>

<div class="defun">
&mdash; Function File: [<var>d</var>, <var>dd</var>] = <b>diffpara</b> (<var>x, a, b</var>)<var><a name="index-diffpara-2157"></a></var><br>
<blockquote><p>Return the estimator <var>d</var> for the differencing parameter of an
integrated time series.

        <p>The frequencies from [2*pi*a/t, 2*pi*b/T] are used for the
estimation.  If <var>b</var> is omitted, the interval
[2*pi/T, 2*pi*a/T] is used.  If both <var>b</var> and <var>a</var> are
omitted then a = 0.5 * sqrt (T) and b = 1.5 * sqrt (T)
is used, where T is the sample size.  If <var>x</var> is a matrix,
the differencing parameter of each column is estimated.

        <p>The estimators for all frequencies in the intervals
described above is returned in <var>dd</var>.  The value of <var>d</var> is
simply the mean of <var>dd</var>.

        <p>Reference: Brockwell, Peter J. &amp; Davis, Richard A. Time Series:
Theory and Methods Springer 1987. 
</p></blockquote></div>

<!-- ./signal/durbinlevinson.m -->
   <p><a name="doc_002ddurbinlevinson"></a>

<div class="defun">
&mdash; Function File:  <b>durbinlevinson</b> (<var>c, oldphi, oldv</var>)<var><a name="index-durbinlevinson-2158"></a></var><br>
<blockquote><p>Perform one step of the Durbin-Levinson algorithm.

        <p>The vector <var>c</var> specifies the autocovariances <code>[gamma_0, ...,
gamma_t]</code> from lag 0 to <var>t</var>, <var>oldphi</var> specifies the
coefficients based on <var>c</var>(<var>t</var>-1) and <var>oldv</var> specifies the
corresponding error.

        <p>If <var>oldphi</var> and <var>oldv</var> are omitted, all steps from 1 to
<var>t</var> of the algorithm are performed. 
</p></blockquote></div>

<!-- ./signal/fftshift.m -->
   <p><a name="doc_002dfftshift"></a>

<div class="defun">
&mdash; Function File:  <b>fftshift</b> (<var>v</var>)<var><a name="index-fftshift-2159"></a></var><br>
&mdash; Function File:  <b>fftshift</b> (<var>v, dim</var>)<var><a name="index-fftshift-2160"></a></var><br>
<blockquote><p>Perform a shift of the vector <var>v</var>, for use with the <code>fft</code>
and <code>ifft</code> functions, in order the move the frequency 0 to the
center of the vector or matrix.

        <p>If <var>v</var> is a vector of N elements corresponding to N
time samples spaced of Dt each, then <code>fftshift (fft
(</code><var>v</var><code>))</code> corresponds to frequencies

     <pre class="example">          f = ((1:N) - ceil(N/2)) / N / Dt
</pre>
        <p>If <var>v</var> is a matrix, the same holds for rows and columns.  If
<var>v</var> is an array, then the same holds along each dimension.

        <p>The optional <var>dim</var> argument can be used to limit the dimension
along which the permutation occurs. 
</p></blockquote></div>

<!-- ./signal/ifftshift.m -->
   <p><a name="doc_002difftshift"></a>

<div class="defun">
&mdash; Function File:  <b>ifftshift</b> (<var>v</var>)<var><a name="index-ifftshift-2161"></a></var><br>
&mdash; Function File:  <b>ifftshift</b> (<var>v, dim</var>)<var><a name="index-ifftshift-2162"></a></var><br>
<blockquote><p>Undo the action of the <code>fftshift</code> function.  For even length
<var>v</var>, <code>fftshift</code> is its own inverse, but odd lengths differ
slightly. 
</p></blockquote></div>

<!-- ./signal/fractdiff.m -->
   <p><a name="doc_002dfractdiff"></a>

<div class="defun">
&mdash; Function File:  <b>fractdiff</b> (<var>x, d</var>)<var><a name="index-fractdiff-2163"></a></var><br>
<blockquote><p>Compute the fractional differences (1-L)^d x where L
denotes the lag-operator and d is greater than -1. 
</p></blockquote></div>

<!-- ./signal/hamming.m -->
   <p><a name="doc_002dhamming"></a>

<div class="defun">
&mdash; Function File:  <b>hamming</b> (<var>m</var>)<var><a name="index-hamming-2164"></a></var><br>
<blockquote><p>Return the filter coefficients of a Hamming window of length <var>m</var>.

        <p>For a definition of the Hamming window, see e.g., A. V. Oppenheim &amp;
R. W. Schafer, <cite>Discrete-Time Signal Processing</cite>. 
</p></blockquote></div>

<!-- ./signal/hanning.m -->
   <p><a name="doc_002dhanning"></a>

<div class="defun">
&mdash; Function File:  <b>hanning</b> (<var>m</var>)<var><a name="index-hanning-2165"></a></var><br>
<blockquote><p>Return the filter coefficients of a Hanning window of length <var>m</var>.

        <p>For a definition of this window type, see e.g., A. V. Oppenheim &amp;
R. W. Schafer, <cite>Discrete-Time Signal Processing</cite>. 
</p></blockquote></div>

<!-- ./signal/hurst.m -->
   <p><a name="doc_002dhurst"></a>

<div class="defun">
&mdash; Function File:  <b>hurst</b> (<var>x</var>)<var><a name="index-hurst-2166"></a></var><br>
<blockquote><p>Estimate the Hurst parameter of sample <var>x</var> via the rescaled range
statistic.  If <var>x</var> is a matrix, the parameter is estimated for
every single column. 
</p></blockquote></div>

<!-- ./polynomial/pchip.m -->
   <p><a name="doc_002dpchip"></a>

<div class="defun">
&mdash; Function File: <var>pp</var> = <b>pchip</b> (<var>x, y</var>)<var><a name="index-pchip-2167"></a></var><br>
&mdash; Function File: <var>yi</var> = <b>pchip</b> (<var>x, y, xi</var>)<var><a name="index-pchip-2168"></a></var><br>
<blockquote>
        <p>Piecewise Cubic Hermite interpolating polynomial.  Called with two
arguments, the piece-wise polynomial <var>pp</var> is returned, that may
later be used with <code>ppval</code> to evaluate the polynomial at
specific points.

        <p>The variable <var>x</var> must be a strictly monotonic vector (either
increasing or decreasing).  While <var>y</var> can be either a vector or
array.  In the case where <var>y</var> is a vector, it must have a length
of <var>n</var>.  If <var>y</var> is an array, then the size of <var>y</var> must
have the form
<code>[</code><var>s1</var><code>, </code><var>s2</var><code>, ..., </code><var>sk</var><code>, </code><var>n</var><code>]</code>
The array is then reshaped internally to a matrix where the leading
dimension is given by
<var>s1</var><code> * </code><var>s2</var><code> * ... * </code><var>sk</var>
and each row in this matrix is then treated separately.  Note that this
is exactly the opposite treatment than <code>interp1</code> and is done
for compatibility.

        <p>Called with a third input argument, <code>pchip</code> evaluates the
piece-wise polynomial at the points <var>xi</var>.  There is an equivalence
between <code>ppval (pchip (</code><var>x</var><code>, </code><var>y</var><code>), </code><var>xi</var><code>)</code> and
<code>pchip (</code><var>x</var><code>, </code><var>y</var><code>, </code><var>xi</var><code>)</code>.

     <!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
     <!-- A simple blank line produces the correct behavior. -->
     <!-- @sp 1 -->
     <p class="noindent"><strong>See also:</strong> <a href="doc_002dspline.html#doc_002dspline">spline</a>, <a href="doc_002dppval.html#doc_002dppval">ppval</a>, <a href="doc_002dmkpp.html#doc_002dmkpp">mkpp</a>, <a href="doc_002dunmkpp.html#doc_002dunmkpp">unmkpp</a>. 
</p></blockquote></div>

<!-- ./signal/periodogram.m -->
   <p><a name="doc_002dperiodogram"></a>

<div class="defun">
&mdash; Function File:  <b>periodogram</b> (<var>x</var>)<var><a name="index-periodogram-2169"></a></var><br>
<blockquote><p>For a data matrix <var>x</var> from a sample of size <var>n</var>, return the
periodogram. 
</p></blockquote></div>

<!-- ./signal/rectangle_lw.m -->
   <p><a name="doc_002drectangle_005flw"></a>

<div class="defun">
&mdash; Function File:  <b>rectangle_lw</b> (<var>n, b</var>)<var><a name="index-rectangle_005flw-2170"></a></var><br>
<blockquote><p>Rectangular lag window.  Subfunction used for spectral density
estimation. 
</p></blockquote></div>

<!-- ./signal/rectangle_sw.m -->
   <p><a name="doc_002drectangle_005fsw"></a>

<div class="defun">
&mdash; Function File:  <b>rectangle_sw</b> (<var>n, b</var>)<var><a name="index-rectangle_005fsw-2171"></a></var><br>
<blockquote><p>Rectangular spectral window.  Subfunction used for spectral density
estimation. 
</p></blockquote></div>

<!-- ./signal/sinetone.m -->
   <p><a name="doc_002dsinetone"></a>

<div class="defun">
&mdash; Function File:  <b>sinetone</b> (<var>freq, rate, sec, ampl</var>)<var><a name="index-sinetone-2172"></a></var><br>
<blockquote><p>Return a sinetone of frequency <var>freq</var> with length of <var>sec</var>
seconds at sampling rate <var>rate</var> and with amplitude <var>ampl</var>. 
The arguments <var>freq</var> and <var>ampl</var> may be vectors of common size.

        <p>Defaults are <var>rate</var> = 8000, <var>sec</var> = 1 and <var>ampl</var> = 64. 
</p></blockquote></div>

<!-- ./signal/sinewave.m -->
   <p><a name="doc_002dsinewave"></a>

<div class="defun">
&mdash; Function File:  <b>sinewave</b> (<var>m, n, d</var>)<var><a name="index-sinewave-2173"></a></var><br>
<blockquote><p>Return an <var>m</var>-element vector with <var>i</var>-th element given by
<code>sin (2 * pi * (</code><var>i</var><code>+</code><var>d</var><code>-1) / </code><var>n</var><code>)</code>.

        <p>The default value for <var>d</var> is 0 and the default value for <var>n</var>
is <var>m</var>. 
</p></blockquote></div>

<!-- ./signal/spectral_adf.m -->
   <p><a name="doc_002dspectral_005fadf"></a>

<div class="defun">
&mdash; Function File:  <b>spectral_adf</b> (<var>c, win, b</var>)<var><a name="index-spectral_005fadf-2174"></a></var><br>
<blockquote><p>Return the spectral density estimator given a vector of
autocovariances <var>c</var>, window name <var>win</var>, and bandwidth,
<var>b</var>.

        <p>The window name, e.g., <code>"triangle"</code> or <code>"rectangle"</code> is
used to search for a function called <var>win</var><code>_sw</code>.

        <p>If <var>win</var> is omitted, the triangle window is used.  If <var>b</var> is
omitted, <code>1 / sqrt (length (</code><var>x</var><code>))</code> is used. 
</p></blockquote></div>

<!-- ./signal/spectral_xdf.m -->
   <p><a name="doc_002dspectral_005fxdf"></a>

<div class="defun">
&mdash; Function File:  <b>spectral_xdf</b> (<var>x, win, b</var>)<var><a name="index-spectral_005fxdf-2175"></a></var><br>
<blockquote><p>Return the spectral density estimator given a data vector <var>x</var>,
window name <var>win</var>, and bandwidth, <var>b</var>.

        <p>The window name, e.g., <code>"triangle"</code> or <code>"rectangle"</code> is
used to search for a function called <var>win</var><code>_sw</code>.

        <p>If <var>win</var> is omitted, the triangle window is used.  If <var>b</var> is
omitted, <code>1 / sqrt (length (</code><var>x</var><code>))</code> is used. 
</p></blockquote></div>

<!-- ./signal/spencer.m -->
   <p><a name="doc_002dspencer"></a>

<div class="defun">
&mdash; Function File:  <b>spencer</b> (<var>x</var>)<var><a name="index-spencer-2176"></a></var><br>
<blockquote><p>Return Spencer's 15 point moving average of every single column of
<var>x</var>. 
</p></blockquote></div>

<!-- ./signal/stft.m -->
   <p><a name="doc_002dstft"></a>

<div class="defun">
&mdash; Function File: [<var>y</var>, <var>c</var>] = <b>stft</b> (<var>x, win_size, inc, num_coef, w_type</var>)<var><a name="index-stft-2177"></a></var><br>
<blockquote><p>Compute the short-time Fourier transform of the vector <var>x</var> with
<var>num_coef</var> coefficients by applying a window of <var>win_size</var> data
points and an increment of <var>inc</var> points.

        <p>Before computing the Fourier transform, one of the following windows
is applied:

          <dl>
<dt>hanning<dd>w_type = 1
<br><dt>hamming<dd>w_type = 2
<br><dt>rectangle<dd>w_type = 3
</dl>

        <p>The window names can be passed as strings or by the <var>w_type</var> number.

        <p>If not all arguments are specified, the following defaults are used:
<var>win_size</var> = 80, <var>inc</var> = 24, <var>num_coef</var> = 64, and
<var>w_type</var> = 1.

        <p><var>y</var><code> = stft (</code><var>x</var><code>, ...)</code> returns the absolute values
of the Fourier coefficients according to the <var>num_coef</var> positive
frequencies.

        <p><code>[</code><var>y</var><code>, </code><var>c</var><code>] = stft (x, ...)</code> returns the
entire STFT-matrix <var>y</var> and a 3-element vector <var>c</var> containing
the window size, increment, and window type, which is needed by the
synthesis function. 
</p></blockquote></div>

<!-- ./signal/synthesis.m -->
   <p><a name="doc_002dsynthesis"></a>

<div class="defun">
&mdash; Function File:  <b>synthesis</b> (<var>y, c</var>)<var><a name="index-synthesis-2178"></a></var><br>
<blockquote><p>Compute a signal from its short-time Fourier transform <var>y</var> and a
3-element vector <var>c</var> specifying window size, increment, and
window type.

        <p>The values <var>y</var> and <var>c</var> can be derived by

     <pre class="example">          [<var>y</var>, <var>c</var>] = stft (<var>x</var> , ...)
</pre>
        </blockquote></div>

<!-- ./signal/triangle_lw.m -->
   <p><a name="doc_002dtriangle_005flw"></a>

<div class="defun">
&mdash; Function File:  <b>triangle_lw</b> (<var>n, b</var>)<var><a name="index-triangle_005flw-2179"></a></var><br>
<blockquote><p>Triangular lag window.  Subfunction used for spectral density
estimation. 
</p></blockquote></div>

<!-- ./signal/triangle_sw.m -->
   <p><a name="doc_002dtriangle_005fsw"></a>

<div class="defun">
&mdash; Function File:  <b>triangle_sw</b> (<var>n, b</var>)<var><a name="index-triangle_005fsw-2180"></a></var><br>
<blockquote><p>Triangular spectral window.  Subfunction used for spectral density
estimation. 
</p></blockquote></div>

<!-- ./signal/yulewalker.m -->
   <p><a name="doc_002dyulewalker"></a>

<div class="defun">
&mdash; Function File: [<var>a</var>, <var>v</var>] = <b>yulewalker</b> (<var>c</var>)<var><a name="index-yulewalker-2181"></a></var><br>
<blockquote><p>Fit an AR (p)-model with Yule-Walker estimates given a vector <var>c</var>
of autocovariances <code>[gamma_0, ..., gamma_p]</code>.

        <p>Returns the AR coefficients, <var>a</var>, and the variance of white
noise, <var>v</var>. 
</p></blockquote></div>

<!-- DO NOT EDIT!  Generated automatically by munge-texi. -->
<!-- Copyright (C) 1996, 1997, 2007, 2008, 2009 John W. Eaton -->
<!-- This file is part of Octave. -->
<!-- Octave is free software; you can redistribute it and/or modify it -->
<!-- under the terms of the GNU General Public License as published by the -->
<!-- Free Software Foundation; either version 3 of the License, or (at -->
<!-- your option) any later version. -->
<!-- Octave is distributed in the hope that it will be useful, but WITHOUT -->
<!-- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -->
<!-- FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License -->
<!-- for more details. -->
<!-- You should have received a copy of the GNU General Public License -->
<!-- along with Octave; see the file COPYING.  If not, see -->
<!-- <http://www.gnu.org/licenses/>. -->
   </body></html>