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.org.
detrend (x p) | Function File |
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 The second argument is optional. If it is not specified a value of 1 is assumed. This corresponds to removing a linear trend. |
fft (a n, dim) | Loadable Function |
Compute the FFT of a using subroutines from
FFTPACK. The FFT is calculated along the first non-singleton dimension of the
array. Thus if a is a matrix fft ( a) 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 or an empty matrix to specify that its value should be ignored. If n is larger than the dimension along which the FFT is calculated then a is resized and padded with zeros. Otherwise ifn is smaller than the dimension along which the FFT is calculated then a is truncated. If called with three agruments dim is an integer specifying the dimension of the matrix along which the FFT is performed |
ifft (a n, dim) | Loadable Function |
Compute the inverse FFT of a using subroutines from
FFTPACK. The inverse FFT is calculated along the first non-singleton dimension
of the array. Thus if a is a matrix fft ( a) 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 or an empty matrix to specify that its value should be ignored. If n is larger than the dimension along which the inverse FFT is calculated then a is resized and padded with zeros. Otherwise ifn is smaller than the dimension along which the inverse FFT is calculated then a is truncated. If called with three agruments dim is an integer specifying the dimension of the matrix along which the inverse FFT is performed |
fft2 (a n, m) | Loadable Function |
Compute the two dimensional FFT of a using subroutines from
FFTPACK. 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.
If a is a multi-dimensional matrix each two-dimensional sub-matrix of a is treated seperately |
fft2 (a n, m) | Loadable Function |
Compute the inverse two dimensional FFT of a using subroutines from
FFTPACK. 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.
If a is a multi-dimensional matrix each two-dimensional sub-matrix of a is treated seperately |
fftn (a size) | Loadable Function |
Compute the N dimensional FFT of a using subroutines from FFTPACK. The optional vector argument size may be used specify the dimensions of the array to be used. If an element of size is smaller than the corresponding dimension then the dimension is truncated prior to performing the FFT. Otherwise if an element of size is larger than the corresponding dimension a is resized and padded with zeros. |
ifftn (a size) | Loadable Function |
Compute the invesre N dimensional FFT of a using subroutines from FFTPACK. The optional vector argument size may be used specify the dimensions of the array to be used. If an element of size is smaller than the corresponding dimension then the dimension is truncated prior to performing the inverse FFT. Otherwise if an element of size is larger than the corresponding dimension a is resized and padded with zeros. |
fftconv (a b, n) | Function File |
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 (b x, n) | Function File |
With two arguments Given the optional third argument n, If x is a matrix filter each column of the matrix. |
y = filter (b a, x) | Loadable Function |
[y sf] = filter (b, a, x, si) | Loadable Function |
[y sf] = filter (b, a, x, [], dim) | Loadable Function |
[y sf] = filter (b, a, x, si, dim) | Loadable Function |
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. over the first non-singleton dimension of x or over dim if supplied. 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). If the fourth argument si is provided it 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 supplied the initial state vector is set to all zeros. 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 |
[h w] = freqz (b, a, n, "whole") | Function File |
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. | |
h = freqz (b a, w) | Function File |
Evaluate the response at the specific frequencies in the vector w. The values for w are measured in radians. | |
[...] = freqz (... Fs) | Function File |
Return frequencies in Hz instead of radians assuming a sampling rate Fs. If you are evaluating the response at specific frequencies w those frequencies should be requested in Hz rather than radians. | |
freqz (...) | Function File |
Plot the pass band stop band and phase response of h rather than returning them. |
freqz_plot (w h) | Function File |
Plot the pass band stop band and phase response of h. |
sinc (x) | Function File |
Return sin(pi*x)/(pi*x). |
b = unwrap (a tol, dim) | Function File |
Unwrap radian phases by adding multiples of 2*pi as appropriate to remove jumps greater than tol. tol defaults to pi. Unwrap will unwrap along the first non-singleton dimension of a unless the optional argument dim is given, in which case the data will be unwrapped along this dimension |
[a b] = arch_fit (y, x, p, iter, gamma, a0, b0) | Function File |
Fit an ARCH regression model to the time series y using the
scoring algorithm in Engle's original ARCH paper. The model is
y(t) = b(1) * x(t1) + ... + b(k) * x(t,k) + e(t), h(t) = a(1) + a(2) * e(t-1)^2 + ... + a(p+1) * e(t-p)^2 in which e(t) is N(0 h(t)), given a time-series vector y up to time t-1 and a matrix of (ordinary) regressors x up to t. The order of the regression of the residual variance is specified by p. If invoked as [1 y(t-1), ..., y(t-k)] Optionally one can specify the number of iterations iter, the updating factor gamma and initial values a0 and b0 for the scoring algorithm. |
arch_rnd (a b, t) | Function File |
Simulate an ARCH sequence of length t with AR
coefficients b and CH coefficients a. I.e. the result
y(t) follows the model
y(t) = b(1) + b(2) * y(t-1) + ... + b(lb) * y(t-lb+1) + e(t) where e(t) given y up to time t-1, is N(0 h(t)), with h(t) = a(1) + a(2) * e(t-1)^2 + ... + a(la) * e(t-la+1)^2 |
[pval lm] = arch_test (y, x, p) | Function File |
For a linear regression model
y = x * b + e perform a Lagrange Multiplier (LM) test of the null hypothesis of no conditional heteroscedascity against the alternative of CH(p). I.e. the model is y(t) = b(1) * x(t1) + ... + b(k) * x(t,k) + e(t), given y up to t-1 and x up to t e(t) is N(0 h(t)) with h(t) = v + a(1) * e(t-1)^2 + ... + a(p) * e(t-p)^2 and the null is a(1) == ... == a(p) == 0. If the second argument is a scalar integer k, perform the same test in a linear autoregression model of order k i.e., with [1 y(t-1), ..., y(t-k)] as the t-th row of x. Under the null LM approximately has a chisquare distribution with p degrees of freedom and pval is the p-value (1 minus the CDF of this distribution at LM) of the test. If no output argument is given the p-value is displayed. |
arma_rnd (a b, v, t, n) | Function File |
Return a simulation of the ARMA model
x(n) = a(1) * x(n-1) + ... + a(k) * x(n-k) + e(n) + b(1) * e(n-1) + ... + b(l) * e(n-l) in which k is the length of vector a l is the length of vector b and e is gaussian white noise with variance v. The function returns a vector of length t. The optional parameter n gives the number of dummy x(i) used for initialization i.e., a sequence of length t+n is generated and x(n+1:t+n) is returned. If n is omitted n = 100 is used. |
autocor (x h) | Function File |
Return the autocorrelations from lag 0 to h of vector x. If h is omitted all autocorrelations are computed. If x is a matrix the autocorrelations of each column are computed. |
autocov (x h) | Function File |
Return the autocovariances from lag 0 to h of vector x. If h is omitted all autocovariances are computed. If x is a matrix the autocovariances of each column are computed. |
autoreg_matrix (y k) | Function File |
Given a time series (vector) y return a matrix with ones in the
first column and the first k lagged values of y in the
other columns. I.e. for t > k, [1,
y( t-1) ..., y( t- k)] is the t-th row
of the result. The resulting matrix may be used as a regressor matrix
in autoregressions.
|
bartlett (m) | Function File |
Return the filter coefficients of a Bartlett (triangular) window of
length m.
For a definition of the Bartlett window see e.g. A. V. Oppenheim & R. W. Schafer "Discrete-Time Signal Processing". |
blackman (m) | Function File |
Return the filter coefficients of a Blackman window of length m.
For a definition of the Blackman window see e.g. A. V. Oppenheim & R. W. Schafer "Discrete-Time Signal Processing". |
[d dd] = diffpara (x, a, b) | Function File |
Return the estimator d for the differencing parameter of an
integrated time series.
The frequencies from [2*pi*a/t 2*pi*b/T] are used for the estimation. If b is omitted the interval [2*pi/T 2*pi*a/T] is used. If both b and a are omitted then a = 0.5 * sqrt (T) and b = 1.5 * sqrt (T) is used where T is the sample size. If x is a matrix, the differencing parameter of each column is estimated. The estimators for all frequencies in the intervals described above is returned in dd. The value of d is simply the mean of dd. Reference: Brockwell Peter J. & Davis, Richard A. Time Series: Theory and Methods Springer 1987. |
durbinlevinson (c oldphi, oldv) | Function File |
Perform one step of the Durbin-Levinson algorithm.
The vector c specifies the autocovariances If oldphi and oldv are omitted all steps from 1 to t of the algorithm are performed. |
fftshift (v) | Function File |
fftshift (v dim) | Function File |
Perform a shift of the vector v for use with the fft
and ifft functions in order the move the frequency 0 to the
center of the vector or matrix.
If v is a vector of N elements corresponding to N
time samples spaced of Dt each then f = ((1:N) - ceil(N/2)) / N / Dt If v is a matrix the same holds for rows and columns. If v is an array then the same holds along each dimension. The optional dim argument can be used to limit the dimension along which the permutation occurs. |
fractdiff (x d) | Function File |
Compute the fractional differences (1-L)^d x where L denotes the lag-operator and d is greater than -1. |
hamming (m) | Function File |
Return the filter coefficients of a Hamming window of length m.
For a definition of the Hamming window see e.g. A. V. Oppenheim & R. W. Schafer "Discrete-Time Signal Processing". |
hanning (m) | Function File |
Return the filter coefficients of a Hanning window of length m.
For a definition of this window type see e.g. A. V. Oppenheim & R. W. Schafer "Discrete-Time Signal Processing". |
hurst (x) | Function File |
Estimate the Hurst parameter of sample x via the rescaled range statistic. If x is a matrix the parameter is estimated for every single column. |
periodogram (x) | Function File |
For a data matrix x from a sample of size n return the periodogram. |
rectangle_lw (n b) | Function File |
Rectangular lag window. Subfunction used for spectral density estimation. |
rectangle_sw (n b) | Function File |
Rectangular spectral window. Subfunction used for spectral density estimation. |
sinetone (freq rate, sec, ampl) | Function File |
Return a sinetone of frequency freq with length of sec
seconds at sampling rate rate and with amplitude ampl.
The arguments freq and ampl may be vectors of common size.
Defaults are rate = 8000 sec = 1 and ampl = 64. |
sinewave (m n, d) | Function File |
Return an m-element vector with i-th element given by
sin (2 * pi * ( i+ d-1) / n) .
The default value for d is 0 and the default value for n is m. |
spectral_adf (c win, b) | Function File |
Return the spectral density estimator given a vector of
autocovariances c window name win, and bandwidth,
b.
The window name e.g., If win is omitted the triangle window is used. If b is
omitted |
spectral_xdf (x win, b) | Function File |
Return the spectral density estimator given a data vector x
window name win and bandwidth, b.
The window name e.g., If win is omitted the triangle window is used. If b is
omitted |
spencer (x) | Function File |
Return Spencer's 15 point moving average of every single column of x. |
[y c] = stft (x, win_size, inc, num_coef, w_type) | Function File |
Compute the short-term Fourier transform of the vector x with
num_coef coefficients by applying a window of win_size data
points and an increment of inc points.
Before computing the Fourier transform one of the following windows is applied:
The window names can be passed as strings or by the w_type number. If not all arguments are specified the following defaults are used: win_size = 80 inc = 24, num_coef = 64, and w_type = 1.
|
synthesis (y c) | Function File |
Compute a signal from its short-time Fourier transform y and a
3-element vector c specifying window size increment, and
window type.
The values y and c can be derived by [y c] = stft (x , ...) |
triangle_lw (n b) | Function File |
Triangular lag window. Subfunction used for spectral density estimation. |
triangle_sw (n b) | Function File |
Triangular spectral window. Subfunction used for spectral density estimation. |
[a v] = yulewalker (c) | Function File |
Fit an AR (p)-model with Yule-Walker estimates given a vector c
of autocovariances [gamma_0 ..., gamma_p] .
Returns the AR coefficients a, and the variance of white noise v. |