Signal Processing
*****************

I hope that someday Octave will include more signal processing functions.  If you would like to help improve Octave in this area, please contact bug-octave@bevo.che.wisc.edu.

 -- Function File: detrend (X, P)
     If X is a vector, detrend (X, P) removes the best fit of a polynomial of order P from the data X.

     If X is a matrix, detrend (X, P) does the same for each column in X.

     The second argument is optional.  If it is not specified, a value of 1 is assumed.  This corresponds to removing a linear trend.

 -- Function: fft (A, N)
     Compute the FFT of A using subroutines from FFTPACK.  If A is a matrix, fft computes the FFT for each column of A.

     If called with two arguments, N is expected to be an integer specifying the number of elements of A to use.  If A is a matrix, N specifies the number of rows of A to use.  If N is larger than the size of A, A is resized and padded with zeros.

 -- Loadable Function: ifft (A, N)
     Compute the inverse FFT of A using subroutines from FFTPACK.  If A is a matrix, fft computes the inverse FFT for each column of A.

     If called with two arguments, N is expected to be an integer specifying the number of elements of A to use.  If A is a matrix, N specifies the number of rows of A to use.  If N is larger than the size of A, A is resized and padded with zeros.

 -- Loadable Function: fft2 (A, N, M)
     Compute the two dimensional FFT of A.

     The optional arguments N and M may be used specify the number of rows and columns of A to use.  If either of these is larger than the size of A, A is resized and padded with zeros.

 -- Loadable Function: ifft2 (A, N, M)
     Compute the two dimensional inverse FFT of A.

     The optional arguments N and M may be used specify the number of rows and columns of A to use.  If either of these is larger than the size of A, A is resized and padded with zeros.

 -- Built-in Function: fftconv (A, B, N)
     Return the convolution of the vectors A and B, as a vector with length equal to the length (a) + length (b) - 1.  If A and B are the coefficient vectors of two polynomials, the returned value is the coefficient vector of the product polynomial.

     The computation uses the FFT by calling the function fftfilt.  If the optional argument N is specified, an N-point FFT is used.

 -- Function File: fftfilt (B, X, N)

     With two arguments, fftfilt filters X with the FIR filter B using the FFT.

     Given the optional third argument, N, fftfilt uses the overlap-add method to filter X with B using an N-point FFT.

 -- Loadable Function: y = filter (B, A, X)
     Return the solution to the following linear, time-invariant difference equation:

             N                   M
            SUM a(k+1) y(n-k) = SUM b(k+1) x(n-k)      for 1<=n<=length(x)
            k=0                 k=0

     where N=length(a)-1 and M=length(b)-1. An equivalent form of this equation is:

                      N                   M
            y(n) = - SUM c(k+1) y(n-k) + SUM d(k+1) x(n-k)  for 1<=n<=length(x)
                     k=1                 k=0

     where c = a/a(1) and d = b/a(1).

     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:

                       M
                      SUM d(k+1) z^(-k)
                      k=0
            H(z) = ----------------------
                         N
                    1 + SUM c(k+1) z(-k)
                        k=1

 -- Loadable Function: [Y, SF] = filter (B, A, X, SI)
     This is the same as the filter function described above, except that SI is taken as the initial state of the system and the final state is returned as SF.  The state vector is a column vector whose length is equal to the length of the longest coefficient vector minus one.  If SI is not set, the initial state vector is set to all zeros.

 -- Function File: [H, W] = freqz (B, A, N, "whole")
     Return the complex frequency response H of the rational IIR filter whose numerator and denominator coefficients are B and A, respectively.  The response is evaluated at N angular frequencies between 0 and 2*pi.

     The output value W is a vector of the frequencies.

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

     If N is omitted, a value of 512 is assumed.

     If A is omitted, the denominator is assumed to be 1 (this corresponds to a simple FIR filter).

     For fastest computation, N should factor into a small number of small primes.

 -- Function File: sinc (X)
     Return sin(pi*x)/(pi*x).