summaryrefslogtreecommitdiff
path: root/macros
diff options
context:
space:
mode:
Diffstat (limited to 'macros')
-rw-r--r--macros/czt.sci19
-rw-r--r--macros/dst1.sci11
-rw-r--r--macros/fwht.sci24
-rw-r--r--macros/hilbert1.sci22
-rw-r--r--macros/hurst.sci10
-rw-r--r--macros/ifht.sci18
-rw-r--r--macros/invfreq.sci26
-rw-r--r--macros/libbin6388 -> 6584 bytes
-rw-r--r--macros/rceps.sci14
-rw-r--r--macros/remez1.sci15
-rw-r--r--macros/sinetone.sci14
-rw-r--r--macros/sinewave.sci13
-rw-r--r--macros/spectral_adf.sci15
-rw-r--r--macros/spectral_xdf.sci15
-rw-r--r--macros/spencer.sci8
-rw-r--r--macros/stft.sci35
-rw-r--r--macros/synthesis.sci11
-rw-r--r--macros/yulewalker.sci10
18 files changed, 269 insertions, 11 deletions
diff --git a/macros/czt.sci b/macros/czt.sci
index b027489..84a0253 100644
--- a/macros/czt.sci
+++ b/macros/czt.sci
@@ -1,4 +1,23 @@
function y = czt(x, varargin)
+//Chirp Z Transform
+//Calling Sequence
+//czt (x)
+//czt (x, m)
+//czt (x, m, w)
+//czt (x, m, w, a)
+//Parameters
+//x: Input scalar or vector
+//m: Total Number of steps
+//w: ratio between points in each step
+//a: point in the complex plane
+//Description
+//This is an Octave function.
+//Chirp z-transform. Compute the frequency response starting at a and stepping by w for m steps. a is a point in the complex plane, and w is the ratio between points in each step (i.e., radius increases exponentially, and angle increases linearly).
+//Examples
+// m = 32; ## number of points desired
+// w = exp(-j*2*pi*(f2-f1)/((m-1)*Fs)); ## freq. step of f2-f1/m
+// a = exp(j*2*pi*f1/Fs); ## starting at frequency f1
+// y = czt(x, m, w, a);
funcprot(0);
lhs= argn(1);
diff --git a/macros/dst1.sci b/macros/dst1.sci
index 3b3b4b6..7f2165f 100644
--- a/macros/dst1.sci
+++ b/macros/dst1.sci
@@ -1,5 +1,14 @@
function y = dst1(x, varargin)
-
+//Computes the type I discrete sine transform of x
+//Calling Sequence
+//y= dst1(x)
+//y= dst1(x,n)
+//Parameters
+//x: real or complex valued vector
+//n= Length to which x is trimmed before transform
+//Description
+//This is an Octave function.
+//Computes the type I discrete sine transform of x. If n is given, then x is padded or trimmed to length n before computing the transform. If x is a matrix, compute the transform along the columns of the the matrix.
funcprot(0);
lhs= argn(1);
diff --git a/macros/fwht.sci b/macros/fwht.sci
index 280bbee..e0a15ff 100644
--- a/macros/fwht.sci
+++ b/macros/fwht.sci
@@ -1,4 +1,28 @@
function y = fwht(x, varargin)
+//Compute the Walsh-Hadamard transform of x using the Fast Walsh-Hadamard Transform (FWHT) algorithm
+//Calling Sequence
+//fwht (x)
+//fwht (x, n)
+//fwht (x, n, order)
+//Parameters
+//x: real or complex valued scalar or vector
+//n: x is truncated or extended to have length n
+//order: Specification of order in which coefficients should be arranged
+//Description
+//Compute the Walsh-Hadamard transform of x using the Fast Walsh-Hadamard Transform (FWHT) algorithm. If the input is a matrix, the FWHT is calculated along the columns of x.
+//
+//The number of elements of x must be a power of 2; if not, the input will be extended and filled with zeros. If a second argument is given, the input is truncated or extended to have length n.
+//
+//The third argument specifies the order in which the returned Walsh-Hadamard transform coefficients should be arranged. The order may be any of the following strings:
+//
+//"sequency"
+//The coefficients are returned in sequency order. This is the default if order is not given.
+//
+//"hadamard"
+//The coefficients are returned in Hadamard order.
+//
+//"dyadic"
+//The coefficients are returned in Gray code order.
funcprot(0);
rhs= argn(2);
diff --git a/macros/hilbert1.sci b/macros/hilbert1.sci
index 864067f..1c0fe0e 100644
--- a/macros/hilbert1.sci
+++ b/macros/hilbert1.sci
@@ -1,4 +1,26 @@
function h= hilbert1(f, varargin)
+//Analytic extension of real valued signal.
+//Calling Sequence
+// h= hilbert1(f)
+// h= hilbert1(f,N)
+// h= hilbert1(f,N,dim)
+//Parameters
+//f: real or complex valued scalar or vector
+//N: The result will have length N
+//dim : It analyses the input in this dimension
+//Description
+//h = hilbert (f) computes the extension of the real valued signal f to an analytic signal. If f is a matrix, the transformation is applied to each column. For N-D arrays, the transformation is applied to the first non-singleton dimension.
+//
+//real (h) contains the original signal f. imag (h) contains the Hilbert transform of f.
+//
+//hilbert1 (f, N) does the same using a length N Hilbert transform. The result will also have length N.
+//
+//hilbert1 (f, [], dim) or hilbert1 (f, N, dim) does the same along dimension dim.
+//Examples
+//## notice that the imaginary signal is phase-shifted 90 degrees
+// t=linspace(0,10,256);
+// z = hilbert1(sin(2*pi*0.5*t));
+// grid on; plot(t,real(z),';real;',t,imag(z),';imag;');
funcprot(0);
rhs= argn(2);
diff --git a/macros/hurst.sci b/macros/hurst.sci
index 1a99f8c..27507fb 100644
--- a/macros/hurst.sci
+++ b/macros/hurst.sci
@@ -1,5 +1,13 @@
function y = hurst(x)
-
+// Estimate the Hurst parameter of sample X via the rescaled r statistic.
+//Calling Sequence
+//hurst(X)
+//variable=hurst(X)
+//Parameters
+//X: X is a matrix, the parameter of sample X via the rescaled r statistic
+//Description
+//This is an Octave function.
+//This function estimates the Hurst parameter of sample X via the rescaled rstatistic.
funcprot(0);
rhs= argn(2);
if(rhs<1 | rhs>1)
diff --git a/macros/ifht.sci b/macros/ifht.sci
index aacbd7a..7f865cb 100644
--- a/macros/ifht.sci
+++ b/macros/ifht.sci
@@ -1,4 +1,22 @@
function m = ifht(d, varargin)
+//Calculate the inverse Fast Hartley Transform of real input D
+//Calling Sequence
+//m= ifht (d)
+//m= ifht (d,n)
+//m= ifht (d,n,dim)
+//Parameters
+//d: real or complex valued scalar or vector
+//n: Similar to the options of FFT function
+//dim: Similar to the options of FFT function
+//Description
+//Calculate the inverse Fast Hartley Transform of real input d. If d is a matrix, the inverse Hartley transform is calculated along the columns by default. The options n and dim are similar to the options of FFT function.
+//
+//The forward and inverse Hartley transforms are the same (except for a scale factor of 1/N for the inverse hartley transform), but implemented using different functions.
+//
+//The definition of the forward hartley transform for vector d, m[K] = 1/N \sum_{i=0}^{N-1} d[i]*(cos[K*2*pi*i/N] + sin[K*2*pi*i/N]), for 0 <= K < N. m[K] = 1/N \sum_{i=0}^{N-1} d[i]*CAS[K*i], for 0 <= K < N.
+//Examples
+//ifht(1 : 4)
+//ifht(1:4, 2)
funcprot(0);
rhs= argn(2);
if(rhs<1 | rhs>3)
diff --git a/macros/invfreq.sci b/macros/invfreq.sci
index dde23ef..a720115 100644
--- a/macros/invfreq.sci
+++ b/macros/invfreq.sci
@@ -1,6 +1,28 @@
function [B,A] = invfreq(H,F,nB,nA,W,iter,tol, plane)
-
-
+// Calculates inverse frequency vectors
+//
+// Calling Sequence
+//[B,A] = invfreq(H,F,nB,nA)
+//[B,A] = invfreq(H,F,nB,nA,W)
+//[B,A] = invfreq(H,F,nB,nA,W,[],[],plane)
+//[B,A] = invfreq(H,F,nB,nA,W,iter,tol,plane)
+//
+// Parameters
+// H: desired complex frequency response,It is assumed that A and B are real polynomials, hence H is one-sided.
+// F: vector of frequency samples in radians
+// nA: order of denominator polynomial A
+// nB: order of numerator polynomial B
+//
+// Description
+//Fit filter B(z)/A(z) or B(s)/A(s) to complex frequency response at frequency points F. A and B are real polynomial coefficients of order nA and nB respectively. Optionally, the fit-errors can be weighted vs frequency according to the weights W. Also, the transform plane can be specified as either 's' for continuous time or 'z' for discrete time. 'z' is chosen by default. Eventually, Steiglitz-McBride iterations will be specified by iter and tol.
+//
+// Examples
+// [B,A] = butter(12,1/4);
+// [H,w] = freqz(B,A,128);
+// [Bh,Ah] = invfreq(H,F,4,4);
+// Hh = freqz(Bh,Ah);
+// disp(sprintf('||frequency response error|| = %f',norm(H-Hh)));
+//
funcprot(0);
lhs= argn(1);
rhs= argn(2);
diff --git a/macros/lib b/macros/lib
index aed9de3..5bec6b5 100644
--- a/macros/lib
+++ b/macros/lib
Binary files differ
diff --git a/macros/rceps.sci b/macros/rceps.sci
index 065e482..8b4d89a 100644
--- a/macros/rceps.sci
+++ b/macros/rceps.sci
@@ -1,5 +1,17 @@
function [y, xm]= rceps(x)
-
+//Produce the cepstrum of the signal x, and if desired, the minimum phase reconstruction of the signal x.
+//Calling Sequence
+//[y, xm] = rceps(x)
+//Parameters
+//x: real or complex vector input
+//Produce the cepstrum of the signal x, and if desired, the minimum phase reconstruction of the signal x. If x is a matrix, do so for each column of the matrix.
+//Examples
+// f0 = 70; Fs = 10000; # 100 Hz fundamental, 10kHz sampling rate
+// a = poly (0.985 * exp (1i*pi*[0.1, -0.1, 0.3, -0.3])); # two formants
+// s = 0.005 * randn (1024, 1); # Noise excitation signal
+// s(1:Fs/f0:length(s)) = 1; # Impulse glottal wave
+// x = filter (1, a, s); # Speech signal in x
+// [y, xm] = rceps (x .* hanning (1024)); # cepstrum and min phase reconstruction
funcprot(0)
lhs= argn(1)
rhs= argn(2)
diff --git a/macros/remez1.sci b/macros/remez1.sci
index aabb25e..0400d90 100644
--- a/macros/remez1.sci
+++ b/macros/remez1.sci
@@ -1,4 +1,19 @@
function b = remez1(n,f,a, varargin)
+//Parks-McClellan optimal FIR filter design
+//Calling Sequence
+//b = remez1 (n, f, a)
+//b = remez1 (n, f, a, w)
+//b = remez1 (n, f, a, w, ftype)
+//b = remez1 (n, f, a, w, ftype, griddensity)
+//Parameters
+//n: gives the number of taps in the returned filter
+//f:gives frequency at the band edges [b1 e1 b2 e2 b3 e3 …]
+//a:gives amplitude at the band edges [a(b1) a(e1) a(b2) a(e2) …]
+//w:gives weighting applied to each band
+//ftype:is "bandpass", "hilbert" or "differentiator"
+//griddensity:determines how accurately the filter will be constructed. The minimum value is 16, but higher numbers are slower to compute.
+//Description
+//Frequency is in the range (0, 1), with 1 being the Nyquist frequency.
funcprot(0);
rhs= argn(2);
diff --git a/macros/sinetone.sci b/macros/sinetone.sci
index 006a2e0..407fa45 100644
--- a/macros/sinetone.sci
+++ b/macros/sinetone.sci
@@ -1,5 +1,17 @@
function y= sinetone(x, varargin)
-
+//Return a sinetone of the input
+//Calling Sequence
+//y= sinetone(FREQ)
+//y= sinetone(FREQ, RATE)
+//y= sinetone(FREQ, RATE, SEC)
+//y= sinetone(FREQ, RATE, SEC, AMPL)
+//Parameters
+//FREQ: frequency of sinetone
+//RATE: Sampling rate
+//SEC: Length in seconds
+//AMPL: Amplitude
+//Description
+//Return a sinetone of frequency FREQ with a length of SEC seconds atsampling rate RATE and with amplitude AMPL.The arguments FREQ and AMPL may be vectors of common size.The defaults are RATE = 8000, SEC = 1, and AMPL = 64.
funcprot(0);
rhs= argn(2);
if(rhs<1 | rhs>4)
diff --git a/macros/sinewave.sci b/macros/sinewave.sci
index d5bdfa9..5263f35 100644
--- a/macros/sinewave.sci
+++ b/macros/sinewave.sci
@@ -1,5 +1,16 @@
function y= sinewave(x, varargin)
-
+//Return an M-element vector with I-th element given by 'sin(2* pi *(I+D-1)/N).'
+//Calling Sequence
+//y= sinewave(M)
+//y= sinewave(M,N)
+//y= sinewave(M,N,D)
+//Parameters
+//M: Input vector
+//N: The default value for N is M
+//D: The default value for D is 0
+//AMPL: Amplitude
+//Description
+//Return an M-element vector with I-th element given by 'sin(2* pi *(I+D-1)/N).'
funcprot(0);
rhs= argn(2);
if(rhs<1 | rhs>3)
diff --git a/macros/spectral_adf.sci b/macros/spectral_adf.sci
index ea81f42..38b3990 100644
--- a/macros/spectral_adf.sci
+++ b/macros/spectral_adf.sci
@@ -1,5 +1,20 @@
function y= spectral_adf(x, varargin)
+// Return the spectral density estimator given a vector of autocovariances C, window name WIN, and bandwidth, B.
+//Calling Sequence
+//spectral_adf(C)
+//spectral_adf(C, WIN)
+//spectral_adf(C, WIN, B)
+//Parameters
+//C: Autocovariances
+//WIN: Window names
+//B: Bandwidth
+//Description
+//Return the spectral density estimator given a vector ofautocovariances C, window name WIN, and bandwidth, B.
+//The window name, e.g., "triangle" or "rectangle" is used to search for a function called 'WIN_lw'.
+//If WIN is omitted, the triangle window is used.
+//If B is omitted, '1 / sqrt (length (C))' is used.
+
funcprot(0);
rhs= argn(2);
if(rhs<1 | rhs>3)
diff --git a/macros/spectral_xdf.sci b/macros/spectral_xdf.sci
index fe93327..f0d457b 100644
--- a/macros/spectral_xdf.sci
+++ b/macros/spectral_xdf.sci
@@ -1,5 +1,18 @@
function y= spectral_xdf(x, varargin)
-
+// Return the spectral density estimator given a data vector X, window name WIN, and bandwidth, B.
+//Calling Sequence
+//spectral_xdf(X)
+//spectral_xdf(X, WIN)
+//spectral_xdf(X, WIN, B)
+//Parameters
+//X: Data Vector
+//WIN: Window names
+//B: Bandwidth
+//Description
+//Return the spectral density estimator given a data vector X, window name WIN, and bandwidth, B.
+//The window name, e.g., "triangle" or "rectangle" is used to search for a function called 'WIN_lw'.
+//If WIN is omitted, the triangle window is used.
+//If B is omitted, '1 / sqrt (length (X))' is used.
funcprot(0);
rhs= argn(2);
if(rhs<1 | rhs>3)
diff --git a/macros/spencer.sci b/macros/spencer.sci
index 537ca8a..63a1b83 100644
--- a/macros/spencer.sci
+++ b/macros/spencer.sci
@@ -1,5 +1,11 @@
function y= spencer(x)
-
+//Return Spencer's 15 point moving average of each column of X.
+//Calling Sequence
+//spencer(X)
+//Parameters
+//X: Real scalar or vector
+//Description
+//Return Spencer's 15 point moving average of each column of X.
funcprot(0);
rhs= argn(2);
diff --git a/macros/stft.sci b/macros/stft.sci
index 01d8f9b..7c30360 100644
--- a/macros/stft.sci
+++ b/macros/stft.sci
@@ -1,4 +1,39 @@
function [y,c]= stft(x, varargin)
+//Compute the short-time Fourier transform of the vector X
+//Calling Sequence
+//Y = stft (X)
+//Y = stft (X, WIN_SIZE)
+//Y = stft (X, WIN_SIZE, INC)
+//Y = stft (X, WIN_SIZE, INC, NUM_COEF)
+//Y = stft (X, WIN_SIZE, INC, NUM_COEF, WIN_TYPE)
+//[Y,C] = stft (X)
+//[Y,C] = stft (X, WIN_SIZE)
+//[Y,C] = stft (X, WIN_SIZE, INC)
+//[Y,C] = stft (X, WIN_SIZE, INC, NUM_COEF)
+//[Y,C] = stft (X, WIN_SIZE, INC, NUM_COEF, WIN_TYPE)
+//Parameters
+//X: Real scalar or vector
+//WIN_SIZE: Size of the window used
+//INC: Increment
+//WIN_TYPE: Type of window
+//Description
+//Compute the short-time 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:
+//
+//"hanning" -> win_type = 1
+//
+//"hamming" -> win_type = 2
+//
+//"rectangle" -> win_type = 3
+//
+//The window names can be passed as strings or by the WIN_TYPE number.
+//
+//The following defaults are used for unspecified arguments:WIN_SIZE= 80, INC = 24, NUM_COEF = 64, and WIN_TYPE = 1.
+//
+//Y = stft (X, ...)' returns the absolute values of the Fourier coefficients according to the NUM_COEF positive frequencies.
+//
+//'[Y, C] = stft (x, ...)' returns the entire STFT-matrix Y and a 3-element vector C containing the window size, increment, and window type, which is needed by the 'synthesis' function.
funcprot(0);
lhs= argn(1);
diff --git a/macros/synthesis.sci b/macros/synthesis.sci
index e787c86..7224686 100644
--- a/macros/synthesis.sci
+++ b/macros/synthesis.sci
@@ -1,5 +1,14 @@
function x= synthesis(Y,C)
-
+//Compute a signal from its short-time Fourier transform
+//Calling Sequence
+//X= synthesis(Y,C)
+//Parameters
+//Y: Shirt-time fourier transform
+//C: 3-element vector C specifying window size, increment, window type.
+//Description
+//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 , ...)
funcprot(0);
lhs= argn(1);
rhs= argn(2);
diff --git a/macros/yulewalker.sci b/macros/yulewalker.sci
index ebcb8aa..40fcadb 100644
--- a/macros/yulewalker.sci
+++ b/macros/yulewalker.sci
@@ -1,5 +1,13 @@
function [A,V]= yulewalker(C)
-
+// Fit an AR (p)-model with Yule-Walker estimates given a vector C of autocovariances '[gamma_0, ..., gamma_p]'.
+//Calling Sequence
+//A = yulewalker(C)
+//[A,V]= yulewalker(C)
+//Parameters
+//C: Autocovariances
+//Description
+//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.
funcprot(0);
lhs=argn(1);
rhs= argn(2);