diff options
author | bgtushar | 2017-11-23 19:30:44 +0530 |
---|---|---|
committer | bgtushar | 2017-11-23 19:30:44 +0530 |
commit | e9ab4b0b52db51be30f4ac3d07673c20b48da13c (patch) | |
tree | 8f4ce37de0a028350125acfce71cfe686e79ef24 /macros | |
parent | 14ccddd315f0b97a78e965df1587835ac542e35a (diff) | |
parent | f66d58166a67d6bc89b2a674119410ddaee53d46 (diff) | |
download | FOSSEE-Signal-Processing-Toolbox-e9ab4b0b52db51be30f4ac3d07673c20b48da13c.tar.gz FOSSEE-Signal-Processing-Toolbox-e9ab4b0b52db51be30f4ac3d07673c20b48da13c.tar.bz2 FOSSEE-Signal-Processing-Toolbox-e9ab4b0b52db51be30f4ac3d07673c20b48da13c.zip |
Merge
Diffstat (limited to 'macros')
-rw-r--r-- | macros/besselap.bin | bin | 0 -> 4340 bytes | |||
-rw-r--r-- | macros/besselap.sci | 48 | ||||
-rw-r--r-- | macros/buttap.bin | bin | 0 -> 4104 bytes | |||
-rw-r--r-- | macros/buttap.sci | 45 | ||||
-rw-r--r-- | macros/cheb.bin | bin | 0 -> 3404 bytes | |||
-rw-r--r-- | macros/cheb.sci | 34 | ||||
-rw-r--r-- | macros/cheb1ap.bin | bin | 0 -> 5508 bytes | |||
-rw-r--r-- | macros/cheb1ap.sci | 51 | ||||
-rw-r--r-- | macros/cheb2ap.bin | bin | 0 -> 4056 bytes | |||
-rw-r--r-- | macros/cheb2ap.sci | 39 | ||||
-rw-r--r-- | macros/cplxreal.bin | bin | 0 -> 5940 bytes | |||
-rw-r--r-- | macros/cplxreal.sci | 43 | ||||
-rw-r--r-- | macros/czt.bin | bin | 0 -> 2164 bytes | |||
-rw-r--r-- | macros/czt.sci | 22 | ||||
-rw-r--r-- | macros/dst1.bin | bin | 0 -> 1360 bytes | |||
-rw-r--r-- | macros/dst1.sci | 19 | ||||
-rw-r--r-- | macros/ellipap.bin | bin | 0 -> 5264 bytes | |||
-rw-r--r-- | macros/ellipap.sci | 46 | ||||
-rw-r--r-- | macros/fft.bin | bin | 0 -> 6080 bytes | |||
-rw-r--r-- | macros/fft.sci | 49 | ||||
-rw-r--r-- | macros/fft2.bin | bin | 0 -> 5292 bytes | |||
-rw-r--r-- | macros/fft2.sci | 45 | ||||
-rw-r--r-- | macros/freqs.bin | bin | 0 -> 3628 bytes | |||
-rw-r--r-- | macros/freqs.sci | 29 | ||||
-rw-r--r-- | macros/fwht.bin | bin | 0 -> 1672 bytes | |||
-rw-r--r-- | macros/fwht.sci | 20 | ||||
-rw-r--r-- | macros/hanning.bin | bin | 0 -> 1368 bytes | |||
-rw-r--r-- | macros/hanning.sci | 15 | ||||
-rw-r--r-- | macros/hilbert1.bin | bin | 0 -> 1704 bytes | |||
-rw-r--r-- | macros/hilbert1.sci | 17 | ||||
-rw-r--r-- | macros/hurst.bin | bin | 0 -> 1060 bytes | |||
-rw-r--r-- | macros/hurst.sci | 13 | ||||
-rw-r--r-- | macros/ifft.bin | bin | 0 -> 6476 bytes | |||
-rw-r--r-- | macros/ifft.sci | 51 | ||||
-rw-r--r-- | macros/ifft2.bin | bin | 0 -> 6016 bytes | |||
-rw-r--r-- | macros/ifft2.sci | 45 | ||||
-rw-r--r-- | macros/ifht.bin | bin | 0 -> 1628 bytes | |||
-rw-r--r-- | macros/ifht.sci | 16 | ||||
-rw-r--r-- | macros/ifwht.bin | bin | 0 -> 1684 bytes | |||
-rw-r--r-- | macros/ifwht.sci | 20 | ||||
-rw-r--r-- | macros/invfreq.bin | bin | 0 -> 2520 bytes | |||
-rw-r--r-- | macros/invfreq.sci | 21 | ||||
-rw-r--r-- | macros/lib | bin | 5260 -> 6124 bytes | |||
-rw-r--r-- | macros/names | 36 | ||||
-rw-r--r-- | macros/ncauer.bin | bin | 0 -> 5372 bytes | |||
-rw-r--r-- | macros/ncauer.sci | 49 | ||||
-rw-r--r-- | macros/peak2rms.bin | bin | 13896 -> 13896 bytes | |||
-rw-r--r-- | macros/pei_tseng_notch.bin | bin | 0 -> 5436 bytes | |||
-rw-r--r-- | macros/pei_tseng_notch.sci | 44 | ||||
-rw-r--r-- | macros/rceps.bin | bin | 0 -> 1576 bytes | |||
-rw-r--r-- | macros/rceps.sci | 17 | ||||
-rw-r--r-- | macros/remez1.bin | bin | 0 -> 2424 bytes | |||
-rw-r--r-- | macros/remez1.sci | 21 | ||||
-rw-r--r-- | macros/sinetone.bin | bin | 0 -> 2132 bytes | |||
-rw-r--r-- | macros/sinetone.sci | 20 | ||||
-rw-r--r-- | macros/sinewave.bin | bin | 0 -> 1720 bytes | |||
-rw-r--r-- | macros/sinewave.sci | 18 | ||||
-rw-r--r-- | macros/spectral_adf.bin | bin | 0 -> 1768 bytes | |||
-rw-r--r-- | macros/spectral_adf.sci | 18 | ||||
-rw-r--r-- | macros/spectral_xdf.bin | bin | 0 -> 1768 bytes | |||
-rw-r--r-- | macros/spectral_xdf.sci | 18 | ||||
-rw-r--r-- | macros/spencer.bin | bin | 0 -> 1076 bytes | |||
-rw-r--r-- | macros/spencer.sci | 15 | ||||
-rw-r--r-- | macros/stft.bin | bin | 0 -> 5464 bytes | |||
-rw-r--r-- | macros/stft.sci | 54 | ||||
-rw-r--r-- | macros/synthesis.bin | bin | 0 -> 1256 bytes | |||
-rw-r--r-- | macros/synthesis.sci | 16 | ||||
-rw-r--r-- | macros/wconv.bin | bin | 0 -> 3416 bytes | |||
-rw-r--r-- | macros/wconv.sci | 33 | ||||
-rw-r--r-- | macros/yulewalker.bin | bin | 0 -> 1924 bytes | |||
-rw-r--r-- | macros/yulewalker.sci | 24 | ||||
-rw-r--r-- | macros/zp2ss.bin | bin | 0 -> 5916 bytes | |||
-rw-r--r-- | macros/zp2ss.sci | 65 | ||||
-rw-r--r-- | macros/zp2tf.bin | bin | 0 -> 4116 bytes | |||
-rw-r--r-- | macros/zp2tf.sci | 46 |
75 files changed, 1182 insertions, 0 deletions
diff --git a/macros/besselap.bin b/macros/besselap.bin Binary files differnew file mode 100644 index 0000000..9794042 --- /dev/null +++ b/macros/besselap.bin diff --git a/macros/besselap.sci b/macros/besselap.sci new file mode 100644 index 0000000..6fe4f47 --- /dev/null +++ b/macros/besselap.sci @@ -0,0 +1,48 @@ +function [zero, pole, gain] = besselap (n) +//Return bessel analog filter prototype. +//Calling Sequence +//[zero, pole, gain] = besselap (n) +//[zero, pole] = besselap (n) +//zero = besselap (n) +//Parameters +//n: Filter Order +//zero: Zeros +//pole: Poles +//gain: Gain +//Description +//This is an Octave function. +//It Return bessel analog filter prototype of nth order. +//Examples +//[zero, pole, gain] = besselap (5) +//zero = [](0x0) +//pole = +// +// -0.59058 + 0.90721i +// -0.59058 - 0.90721i +// -0.92644 + 0.00000i +// -0.85155 + 0.44272i +// -0.85155 - 0.44272i +// +//gain = 1 + +funcprot(0); +lhs = argn(1) +rhs = argn(2) +if (rhs < 1 | rhs > 1) +error("Wrong number of input arguments.") +end + +select(rhs) + + case 1 then + if(lhs==1) + zero = callOctave("besselap",n) + elseif(lhs==2) + [zero, pole] = callOctave("besselap",n) + elseif(lhs==3) + [zero, pole, gain] = callOctave("besselap",n) + else + error("Wrong number of output argments.") + end + end +endfunction diff --git a/macros/buttap.bin b/macros/buttap.bin Binary files differnew file mode 100644 index 0000000..10ce21e --- /dev/null +++ b/macros/buttap.bin diff --git a/macros/buttap.sci b/macros/buttap.sci new file mode 100644 index 0000000..9c2e08d --- /dev/null +++ b/macros/buttap.sci @@ -0,0 +1,45 @@ +function [z, p, g] = buttap (n) +//Design a lowpass analog Butterworth filter. +//Calling Sequence +//z = buttap (n) +//[z, p] = buttap (n) +//[z, p, g] = buttap (n) +//Parameters +//n: Filter Order +//z: Zeros +//p: Poles +//g: Gain +//Description +//This is an Octave function. +//It designs a lowpass analog Butterworth filter of nth order. +//Examples +//[z, p, g] = buttap (5) +//z = [](0x0) +//p = +// +// -0.30902 + 0.95106i -0.80902 + 0.58779i -1.00000 + 0.00000i -0.80902 - 0.58779i -0.30902 - 0.95106i +// +//g = 1 + + +funcprot(0); +lhs = argn(1) +rhs = argn(2) +if (rhs < 1 | rhs > 1) +error("Wrong number of input arguments.") +end + +select(rhs) + + case 1 then + if(lhs==1) + z = callOctave("buttap",n) + elseif(lhs==2) + [z, p] = callOctave("buttap",n) + elseif(lhs==3) + [z, p, g] = callOctave("buttap",n) + else + error("Wrong number of output argments.") + end + end +endfunction diff --git a/macros/cheb.bin b/macros/cheb.bin Binary files differnew file mode 100644 index 0000000..28632eb --- /dev/null +++ b/macros/cheb.bin diff --git a/macros/cheb.sci b/macros/cheb.sci new file mode 100644 index 0000000..db2df85 --- /dev/null +++ b/macros/cheb.sci @@ -0,0 +1,34 @@ +function res = cheb (n, x) +//Calculates the nth-order Chebyshev polynomial at the point x. +//Calling Sequence +//cheb(n, x) +//Parameters +//n: Filter order +//x: Point at which the Chebyshev polynomial is calculater. +//Description +//This is an Octave function. +//Equation for Chebyshev polynomial is +// / cos(n acos(x), |x| <= 1 +// Tn(x) = | +// \ cosh(n acosh(x), |x| > 1 +// +//x can also be a vector. In that case the output will also be a vector of same size as x. +//Examples +//x = [1 2 3 4] +// cheb(10, x) +//ans = +// +// 1.0000e+00 2.6209e+05 2.2620e+07 4.5747e+08 + +funcprot(0); +rhs = argn(2) +if (rhs < 2 | rhs > 2) +error("Wrong number of input arguments.") +end + +select(rhs) + + case 2 then + res = callOctave("cheb",n,x) + end +endfunction diff --git a/macros/cheb1ap.bin b/macros/cheb1ap.bin Binary files differnew file mode 100644 index 0000000..7414b4a --- /dev/null +++ b/macros/cheb1ap.bin diff --git a/macros/cheb1ap.sci b/macros/cheb1ap.sci new file mode 100644 index 0000000..361f272 --- /dev/null +++ b/macros/cheb1ap.sci @@ -0,0 +1,51 @@ +function [z, p, g] = cheb1ap (n, Rp) +//This function designs a lowpass analog Chebyshev type I filter. +//Calling Sequence +//[z, p, g] = cheb1ap (n, Rp) +//[z, p] = cheb1ap (n, Rp) +//p = cheb1ap (n, Rp) +//Parameters +//n: Filter Order +//Rp: Peak-to-peak passband ripple +//z: Zeros +//p: Poles +//g: Gain +//Description +//This is an Octave function. +//It designs a lowpass analog Chebyshev type I filter of nth order and with a Peak-to-peak passband ripple of Rp. +//Examples +//[z, p, g] = cheb1ap (10, 20) +//z = [](0x0) +//p = +// +// Columns 1 through 6: +// +// -0.00157 - 0.98774i -0.00456 - 0.89105i -0.00709 - 0.70714i -0.00894 - 0.45401i -0.00991 - 0.15644i -0.00991 + 0.15644i +// +// Columns 7 through 10: +// +// -0.00894 + 0.45401i -0.00709 + 0.70714i -0.00456 + 0.89105i -0.00157 + 0.98774i +// +//g = 1.9630e-04 - 6.3527e-22i + +funcprot(0); +lhs = argn(1) +rhs = argn(2) +if (rhs < 2 | rhs > 2) +error("Wrong number of input arguments.") +end + +select(rhs) + + case 2 then + if(lhs==1) + z = callOctave("cheb1ap", n, Rp) + elseif(lhs==2) + [z, p] = callOctave("cheb1ap", n, Rp) + elseif(lhs==3) + [z, p, g] = callOctave("cheb1ap", n, Rp) + else + error("Wrong number of output argments.") + end + end +endfunction diff --git a/macros/cheb2ap.bin b/macros/cheb2ap.bin Binary files differnew file mode 100644 index 0000000..558a95b --- /dev/null +++ b/macros/cheb2ap.bin diff --git a/macros/cheb2ap.sci b/macros/cheb2ap.sci new file mode 100644 index 0000000..007d2d5 --- /dev/null +++ b/macros/cheb2ap.sci @@ -0,0 +1,39 @@ +function [z, p, g] = cheb2ap (n, Rs) +//This function designs a lowpass analog Chebyshev type II filter. +//Calling Sequence +//[z, p, g] = cheb2ap (n, Rs) +//[z, p] = cheb2ap (n, Rs) +//p = cheb2ap (n, Rs) +//Parameters +//n: Filter Order +//Rs: Stopband attenuation +//z: Zeros +//p: Poles +//g: Gain +//Description +//This is an Octave function. +//This function designs a lowpass analog Chebyshev type II filter of nth order and with a stopband attenuation of Rs. +//Examples +// + +funcprot(0); +lhs = argn(1) +rhs = argn(2) +if (rhs < 2 | rhs > 2) +error("Wrong number of input arguments.") +end + +select(rhs) + + case 2 then + if(lhs==1) + z = callOctave("cheb2ap", n, Rs) + elseif(lhs==2) + [z, p] = callOctave("cheb2ap", n, Rs) + elseif(lhs==3) + [z, p, g] = callOctave("cheb2ap", n, Rs) + else + error("Wrong number of output argments.") + end + end +endfunction diff --git a/macros/cplxreal.bin b/macros/cplxreal.bin Binary files differnew file mode 100644 index 0000000..c5c522b --- /dev/null +++ b/macros/cplxreal.bin diff --git a/macros/cplxreal.sci b/macros/cplxreal.sci new file mode 100644 index 0000000..8443837 --- /dev/null +++ b/macros/cplxreal.sci @@ -0,0 +1,43 @@ +function [zc, zr] = cplxreal (z, thresh) +//Function to divide vector z into complex and real elements, removing the one of each complex conjugate pair. +//Calling Sequence +//[zc, zr] = cplxreal (z, thresh) +//[zc, zr] = cplxreal (z) +//zc = cplxreal (z, thresh) +//zc = cplxreal (z) +//Parameters +//z: vector of complex numbers. +//thresh: tolerance for comparisons. +//zc: vector containing the elements of z that have positive imaginary parts. +//zr: vector containing the elements of z that are real. +//Description +//This is an Octave function. +//Every complex element of z is expected to have a complex-conjugate elsewhere in z. From the pair of complex-conjugates, the one with the negative imaginary part is removed. +//If the magnitude of the imaginary part of an element is less than the thresh, it is declared as real. +funcprot(0); +lhs = argn(1) +rhs = argn(2) +if (rhs < 1 | rhs > 2) +error("Wrong number of input arguments.") +end + +select(rhs) + case 1 then + if(lhs==1) + zc = callOctave("cplxreal",z) + elseif (lhs==2) + [zc, zr] = callOctave("cplxreal",z) + else + error("Wrong number of output argments.") + end + + case 2 then + if(lhs==1) + zc = callOctave("cplxreal",z, thresh) + elseif (lhs==2) + [zc, zr] = callOctave("cplxreal",z, thresh) + else + error("Wrong number of output argments.") + end + end +endfunction diff --git a/macros/czt.bin b/macros/czt.bin Binary files differnew file mode 100644 index 0000000..a9cd8c5 --- /dev/null +++ b/macros/czt.bin diff --git a/macros/czt.sci b/macros/czt.sci new file mode 100644 index 0000000..b027489 --- /dev/null +++ b/macros/czt.sci @@ -0,0 +1,22 @@ +function y = czt(x, varargin) + +funcprot(0); +lhs= argn(1); +rhs= argn(2); + +if(rhs<1 | rhs > 4) +error("Wrong number of input arguments") +end + +select (rhs) + case 1 then + y= callOctave("czt", x); + case 2 then + y= callOctave("czt", x, varargin(1)); + case 3 then + y= callOctave("czt", x, varargin(1), varargin(2)); + case 4 then + y= callOctave("czt", x, varargin(1), varargin(2), varargin(3)); +end +endfunction + diff --git a/macros/dst1.bin b/macros/dst1.bin Binary files differnew file mode 100644 index 0000000..91b23ca --- /dev/null +++ b/macros/dst1.bin diff --git a/macros/dst1.sci b/macros/dst1.sci new file mode 100644 index 0000000..3b3b4b6 --- /dev/null +++ b/macros/dst1.sci @@ -0,0 +1,19 @@ +function y = dst1(x, varargin) + +funcprot(0); + +lhs= argn(1); +rhs= argn(2); + +if(rhs>2) +error("Wrong number of input arguments"); +end + +select(rhs) + case 1 then + y = callOctave("dst", x); + case 2 then + y = callOctave("dst", x, varargin(1)); +end +endfunction + diff --git a/macros/ellipap.bin b/macros/ellipap.bin Binary files differnew file mode 100644 index 0000000..da6ce2e --- /dev/null +++ b/macros/ellipap.bin diff --git a/macros/ellipap.sci b/macros/ellipap.sci new file mode 100644 index 0000000..7b4c1ae --- /dev/null +++ b/macros/ellipap.sci @@ -0,0 +1,46 @@ +function [z, p, g] = ellipap (n, Rp, Rs) +//Designs a lowpass analog elliptic filter. +//Calling Sequence +//[z, p, g] = ellipap (n, Rp, Rs) +//[z, p] = ellipap (n, Rp, Rs) +//z = ellipap (n, Rp, Rs) +//Parameters +//n: Filter Order +//Rp: Peak-to-peak passband ripple +//Rs: Stopband attenuation +//Description +//This is an Octave function. +//It designs a lowpass analog elliptic filter of nth order, with a Peak-to-peak passband ripple of Rp and a stopband attenuation of Rs. +//Examples +//[z, p, g] = ellipap (5, 10, 10) +//z = +// +// 0.0000 + 2.5546i 0.0000 + 1.6835i -0.0000 - 2.5546i -0.0000 - 1.6835i +// +//p = +// +// -0.05243 + 0.63524i -0.01633 + 0.96289i -0.05243 - 0.63524i -0.01633 - 0.96289i -0.07369 + 0.00000i +// +//g = 0.0015012 + +funcprot(0); +lhs = argn(1) +rhs = argn(2) +if (rhs < 3 | rhs > 3) +error("Wrong number of input arguments.") +end + +select(rhs) + + case 3 then + if(lhs==1) + z = callOctave("ellipap", n, Rp, Rs) + elseif(lhs==2) + [z, p] = callOctave("ellipap", n, Rp, Rs) + elseif(lhs==3) + [z, p, g] = callOctave("ellipap", n, Rp, Rs) + else + error("Wrong number of output argments.") + end + end +endfunction diff --git a/macros/fft.bin b/macros/fft.bin Binary files differnew file mode 100644 index 0000000..088707e --- /dev/null +++ b/macros/fft.bin diff --git a/macros/fft.sci b/macros/fft.sci new file mode 100644 index 0000000..0ea54ab --- /dev/null +++ b/macros/fft.sci @@ -0,0 +1,49 @@ +function res = fft (x, n, dim) +//Calculates the discrete Fourier transform of a matrix using Fast Fourier Transform algorithm. +//Calling Sequence +//fft (x, n, dim) +//fft (x, n) +//fft (x) +//Parameters +//x: input matrix +//n: Specifies the number of elements of x to be used +//dim: Specifies the dimention of the matrix along which the FFT is performed +//Description +//This is an Octave function. +//The FFT is calculated along the first non-singleton dimension of the array. Thus, FFT is computed for each column of x. +// +//n is an integer specifying the number of elements of x to use. If n is larger than dimention along. which the FFT is calculated, then x is resized and padded with zeros. +//Similarly, if n is smaller, then x is truncated. +// +//dim is an integer specifying the dimension of the matrix along which the FFT is performed. +//Examples +//x = [1 2 3; 4 5 6; 7 8 9] +//n = 3 +//dim = 2 +//fft (x, n, dim) +//ans = +// +// 6.0000 + 0.0000i -1.5000 + 0.8660i -1.5000 - 0.8660i +// 15.0000 + 0.0000i -1.5000 + 0.8660i -1.5000 - 0.8660i +// 24.0000 + 0.0000i -1.5000 + 0.8660i -1.5000 - 0.8660i + +funcprot(0); +lhs = argn(1) +rhs = argn(2) +if (rhs < 1 | rhs > 3) +error("Wrong number of input arguments.") +end + +select(rhs) + + case 1 then + res = callOctave("fft", x) + + case 2 then + res = callOctave("fft", x, n) + + case 3 then + res = callOctave("fft", x, n, dim) + + end +endfunction diff --git a/macros/fft2.bin b/macros/fft2.bin Binary files differnew file mode 100644 index 0000000..dd6e2cc --- /dev/null +++ b/macros/fft2.bin diff --git a/macros/fft2.sci b/macros/fft2.sci new file mode 100644 index 0000000..58cd70d --- /dev/null +++ b/macros/fft2.sci @@ -0,0 +1,45 @@ +function res = fft2 (A, m, n) +//Calculates the two-dimensional discrete Fourier transform of A using a Fast Fourier Transform algorithm. +//Calling Sequence +//fft2 (A, m, n) +//fft2 (A) +//Parameters +//A: input matrix +//m: number of rows of A to be used +//n: number of columns of A to be used +//Description +//This is an Octave function. +//It performs two-dimentional FFT on the matrix A. m and n 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 separately. +//Examples +//x = [1 2 3; 4 5 6; 7 8 9] +//m = 4 +//n = 4 +//fft2 (A, m, n) +//ans = +// +// 45 + 0i -6 - 15i 15 + 0i -6 + 15i +// -18 - 15i -5 + 8i -6 - 5i 5 - 4i +// 15 + 0i -2 - 5i 5 + 0i -2 + 5i +// -18 + 15i 5 + 4i -6 + 5i -5 - 8i + +funcprot(0); +lhs = argn(1) +rhs = argn(2) +if (rhs < 1 | rhs > 3) +error("Wrong number of input arguments.") +end + +select(rhs) + + case 1 then + res = callOctave("fft2", A) + + case 2 then + error("Wrong number of input arguments.") + + case 3 then + res = callOctave("fft2", A, m, n) + + end +endfunction diff --git a/macros/freqs.bin b/macros/freqs.bin Binary files differnew file mode 100644 index 0000000..066c156 --- /dev/null +++ b/macros/freqs.bin diff --git a/macros/freqs.sci b/macros/freqs.sci new file mode 100644 index 0000000..88773fe --- /dev/null +++ b/macros/freqs.sci @@ -0,0 +1,29 @@ +function h = freqs (b, a, w) +//Compute the s-plane frequency response of the IIR filter. +//Calling Sequence +//h = freqs (b, a, w) +//Parameters +//b: vector containing the coefficients of the numerator of the filter. +//a: vector containing the coefficients of the denominator of the filter. +//w: vector containing frequencies +//Description +//This is an Octave function. +//It computes the s-plane frequency response of the IIR filter B(s)/A(s) as H = polyval(B,j*W)./polyval(A,j*W). +//If called with no output argument, a plot of magnitude and phase are displayed. +//Examples +//B = [1 2]; +//A = [1 1]; +//w = linspace(0,4,128); +//freqs(B,A,w); + +funcprot(0); +rhs = argn(2) +if(rhs<3 | rhs>3) +error("Wrong number of input arguments.") +end + +select (rhs) + case 3 then + y = callOctave("freqs",b, a, w) + end +endfunction diff --git a/macros/fwht.bin b/macros/fwht.bin Binary files differnew file mode 100644 index 0000000..e2b1d80 --- /dev/null +++ b/macros/fwht.bin diff --git a/macros/fwht.sci b/macros/fwht.sci new file mode 100644 index 0000000..280bbee --- /dev/null +++ b/macros/fwht.sci @@ -0,0 +1,20 @@ +function y = fwht(x, varargin) + +funcprot(0); +rhs= argn(2); + +if(rhs<1 | rhs > 3) +error("Wrong number of input arguments"); +end + +select(rhs) + case 1 then + y= callOctave("fwht", x); + case 2 then + y= callOctave("fwht",x, varagin(1)); + case 3 then + y= callOctave("fwht",x, varargin(1), varargin(2)); +end +endfunction + + diff --git a/macros/hanning.bin b/macros/hanning.bin Binary files differnew file mode 100644 index 0000000..fc3aa94 --- /dev/null +++ b/macros/hanning.bin diff --git a/macros/hanning.sci b/macros/hanning.sci new file mode 100644 index 0000000..85860c8 --- /dev/null +++ b/macros/hanning.sci @@ -0,0 +1,15 @@ +function y = hanning(m, varargin) + +funcprot(0); +rhs= argn(2); +if(rhs <1 | rhs>2) +error("Wrong number of Input parameters"); +end + +select(rhs) + case 1 then + y= callOctave("hanning", m); + case 2 then + y= callOctave("hanning", m , varargin(1)); +end +endfunction diff --git a/macros/hilbert1.bin b/macros/hilbert1.bin Binary files differnew file mode 100644 index 0000000..11ff749 --- /dev/null +++ b/macros/hilbert1.bin diff --git a/macros/hilbert1.sci b/macros/hilbert1.sci new file mode 100644 index 0000000..864067f --- /dev/null +++ b/macros/hilbert1.sci @@ -0,0 +1,17 @@ +function h= hilbert1(f, varargin) + +funcprot(0); +rhs= argn(2); +if(rhs<1 | rhs>3) + error("Wrong number of Input Arguments") +end + +select(rhs) + case 1 then + h= callOctave("hilbert", f); + case 2 then + h= callOctave("hilbert", f, varargin(1)); + case 3 then + h= callOctave("hilbert", f, varargin(1), varargin(2)); +end +endfunction diff --git a/macros/hurst.bin b/macros/hurst.bin Binary files differnew file mode 100644 index 0000000..f723804 --- /dev/null +++ b/macros/hurst.bin diff --git a/macros/hurst.sci b/macros/hurst.sci new file mode 100644 index 0000000..1a99f8c --- /dev/null +++ b/macros/hurst.sci @@ -0,0 +1,13 @@ +function y = hurst(x) + +funcprot(0); +rhs= argn(2); +if(rhs<1 | rhs>1) + error("Wrong number of input arguments"); +end + +select(rhs) + case 1 then + y= callOctave("hurst", x); +end +endfunction diff --git a/macros/ifft.bin b/macros/ifft.bin Binary files differnew file mode 100644 index 0000000..1c95870 --- /dev/null +++ b/macros/ifft.bin diff --git a/macros/ifft.sci b/macros/ifft.sci new file mode 100644 index 0000000..70688e4 --- /dev/null +++ b/macros/ifft.sci @@ -0,0 +1,51 @@ +function res = ifft (x, n, dim) +//Calculates the inverse discrete Fourier transform of a matrix using Fast Fourier Transform algorithm. +//Calling Sequence +//ifft (x, n, dim) +//ifft (x, n) +//ifft (x) +//Parameters +//x: input matrix +//n: Specifies the number of elements of x to be used +//dim: Specifies the dimention of the matrix along which the inverse FFT is performed +//Description +//This is an Octave function. +//Description +//This is an Octave function. +//The inverse FFT is calculated along the first non-singleton dimension of the array. Thus, inverse FFT is computed for each column of x. +// +//n is an integer specifying the number of elements of x to use. If n is larger than dimention along. which the inverse FFT is calculated, then x is resized and padded with zeros. +//Similarly, if n is smaller, then x is truncated. +// +//dim is an integer specifying the dimension of the matrix along which the inverse FFT is performed. +//Examples +//x = [1 2 3; 4 5 6; 7 8 9] +//n = 3 +//dim = 2 +//ifft (x, n, dim) +//ans = +// +// 2.00000 + 0.00000i -0.50000 - 0.28868i -0.50000 + 0.28868i +// 5.00000 + 0.00000i -0.50000 - 0.28868i -0.50000 + 0.28868i +// 8.00000 + 0.00000i -0.50000 - 0.28868i -0.50000 + 0.28868i + +funcprot(0); +lhs = argn(1) +rhs = argn(2) +if (rhs < 1 | rhs > 3) +error("Wrong number of input arguments.") +end + +select(rhs) + + case 1 then + res = callOctave("ifft", x) + + case 2 then + res = callOctave("ifft", x, n) + + case 3 then + res = callOctave("ifft", x, n, dim) + + end +endfunction diff --git a/macros/ifft2.bin b/macros/ifft2.bin Binary files differnew file mode 100644 index 0000000..bcd3a09 --- /dev/null +++ b/macros/ifft2.bin diff --git a/macros/ifft2.sci b/macros/ifft2.sci new file mode 100644 index 0000000..8ecb1a5 --- /dev/null +++ b/macros/ifft2.sci @@ -0,0 +1,45 @@ +function res = ifft2 (A, m, n) +//Calculates the inverse two-dimensional discrete Fourier transform of A using a Fast Fourier Transform algorithm. +//Calling Sequence +//ifft2 (A, m, n) +//ifft2 (A) +//Parameters +//A: input matrix +//m: number of rows of A to be used +//n: number of columns of A to be used +//Description +//This is an Octave function. +//It performs inverse two-dimensional FFT on the matrix A. m and n 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 separately. +//Examples +//x = [1 2 3; 4 5 6; 7 8 9] +//m = 4 +//n = 4 +//ifft2 (A, m, n) +//ans = +// +// 2.81250 + 0.00000i -0.37500 + 0.93750i 0.93750 + 0.00000i -0.37500 - 0.93750i +// -1.12500 + 0.93750i -0.31250 - 0.50000i -0.37500 + 0.31250i 0.31250 + 0.25000i +// 0.93750 + 0.00000i -0.12500 + 0.31250i 0.31250 + 0.00000i -0.12500 - 0.31250i +// -1.12500 - 0.93750i 0.31250 - 0.25000i -0.37500 - 0.31250i -0.31250 + 0.50000i + +funcprot(0); +lhs = argn(1) +rhs = argn(2) +if (rhs < 1 | rhs > 3) +error("Wrong number of input arguments.") +end + +select(rhs) + + case 1 then + res = callOctave("ifft2", A) + + case 2 then + error("Wrong number of input arguments.") + + case 3 then + res = callOctave("ifft2", A, m, n) + + end +endfunction diff --git a/macros/ifht.bin b/macros/ifht.bin Binary files differnew file mode 100644 index 0000000..7cab709 --- /dev/null +++ b/macros/ifht.bin diff --git a/macros/ifht.sci b/macros/ifht.sci new file mode 100644 index 0000000..aacbd7a --- /dev/null +++ b/macros/ifht.sci @@ -0,0 +1,16 @@ +function m = ifht(d, varargin) +funcprot(0); +rhs= argn(2); +if(rhs<1 | rhs>3) +error("Wrong number of Inputs") +end + +select(rhs) + case 1 then + m= callOctave("ifht", d); + case 2 then + m= callOctave("ifht", d , varargin(1)); + case 3 then + m= callOctave("ifht", d , varargin(1),varargin(2) ); +end +endfunction diff --git a/macros/ifwht.bin b/macros/ifwht.bin Binary files differnew file mode 100644 index 0000000..2acef55 --- /dev/null +++ b/macros/ifwht.bin diff --git a/macros/ifwht.sci b/macros/ifwht.sci new file mode 100644 index 0000000..163c032 --- /dev/null +++ b/macros/ifwht.sci @@ -0,0 +1,20 @@ +function y= ifwht(x, varargin) + +funcprot(0); +rhs= argn(2); + +if(rhs<1 | rhs>3) +error("Wrong number of input arguments") +end + +select(rhs) + case 1 then + y= callOctave("ifwht", x); + case 2 then + y= callOctave("ifwht", x, varargin(1)); + case 3 then + y= callOctave("ifwht", x, varargin(1), varargin(2)); +end +endfunction + + diff --git a/macros/invfreq.bin b/macros/invfreq.bin Binary files differnew file mode 100644 index 0000000..a13ae55 --- /dev/null +++ b/macros/invfreq.bin diff --git a/macros/invfreq.sci b/macros/invfreq.sci new file mode 100644 index 0000000..dde23ef --- /dev/null +++ b/macros/invfreq.sci @@ -0,0 +1,21 @@ +function [B,A] = invfreq(H,F,nB,nA,W,iter,tol, plane) + + +funcprot(0); +lhs= argn(1); +rhs= argn(2); +if(rhs < 4 | rhs > 8 | rhs == 6 | rhs == 7 ) +error("Wrong number of input arguments"); +end + +select(rhs) + case 4 then + [B,A]= callOctave("invfreq", H,F,nB,nA); + case 5 then + [B,A]= callOctave("invfreq", H,F,nB,nA, W); + case 8 then + [B,A]= callOctave("invfreq", H,F,nB, nA,iter, tol, plane); +end +endfunction + + Binary files differdiff --git a/macros/names b/macros/names index 9b3d915..4bd1ddd 100644 --- a/macros/names +++ b/macros/names @@ -7,6 +7,7 @@ armcov aryule barthannwin bartlett +besselap besself bitrevorder blackman @@ -15,12 +16,16 @@ blackmannuttall bohmanwin boxcar buffer +buttap butter buttord cceps cconv cell2sos +cheb +cheb1ap cheb1ord +cheb2ap cheb2ord chebwin cheby1 @@ -31,8 +36,10 @@ clustersegment cmorwavf convmtx corrmtx +cplxreal cummax cummin +czt db db2pow dctmtx @@ -40,12 +47,16 @@ decimate dftmtx diric downsample +dst1 dutycycle ellip +ellipap ellipord enbw eqtflength falltime +fft +fft2 fftfilt fht filternorm @@ -56,8 +67,10 @@ firpmord firtype flattopwin fracshift +freqs fwhm fwhmjlt +fwht gauspuls gaussdesign gaussian @@ -66,17 +79,25 @@ gmonopuls goertzel grpdelay hann +hanning helperHarmonicDistortionAmplifier +hilbert1 +hurst icceps idct1 idct2 idst1 +ifft +ifft2 +ifht +ifwht iirlp2mb impinvar impz impzlength interp intfilt +invfreq invimpinvar is2rc isallpass @@ -105,6 +126,7 @@ modulate morlet movingrms musicBase +ncauer nnls nuttallwin parzenwin @@ -112,6 +134,7 @@ pchip pchips peak2peak peak2rms +pei_tseng_notch peig periodogram phaseInputParseAs_ab @@ -136,9 +159,11 @@ rc2ac rc2is rc2lar rc2poly +rceps rcosdesign rectpuls rectwin +remez1 resample residued residuez @@ -158,6 +183,8 @@ sgolayfilt shanwavf shiftdata sigmoid_train +sinetone +sinewave slewrate sos2cell sos2ss @@ -166,11 +193,16 @@ sos2zp sosbreak sosfilt specgram +spectral_adf +spectral_xdf +spencer ss2sos statelevels +stft stmcb strips subspaceMethodsInputParser +synthesis tf2sos tf2zp tf2zpk @@ -189,12 +221,16 @@ upsample upsamplefill var vco +wconv welchwin window wkeep wrev xcorr2 xcov1 +yulewalker zerocrossing zp2sos +zp2ss +zp2tf zplane diff --git a/macros/ncauer.bin b/macros/ncauer.bin Binary files differnew file mode 100644 index 0000000..0886fbd --- /dev/null +++ b/macros/ncauer.bin diff --git a/macros/ncauer.sci b/macros/ncauer.sci new file mode 100644 index 0000000..c76eb65 --- /dev/null +++ b/macros/ncauer.sci @@ -0,0 +1,49 @@ +function [Zz, Zp, Zg] = ncauer(Rp, Rs, n) +//Analog prototype for Cauer filter. +//Calling Sequence +//[Zz, Zp, Zg] = ncauer(Rp, Rs, n) +//[Zz, Zp] = ncauer(Rp, Rs, n) +//Zz = ncauer(Rp, Rs, n) +//Parameters +//n: Filter Order +//Rp: Peak-to-peak passband ripple +//Rs: Stopband attenuation +//Description +//This is an Octave function. +//It designs an analog prototype for Cauer filter of nth order, with a Peak-to-peak passband ripple of Rp and a stopband attenuation of Rs. +//Examples +//n = 5; +//Rp = 5; +//Rs = 5; +//[Zz, Zp, Zg] = ncauer(Rp, Rs, n) +//Zz = +// +// 0.0000 + 2.5546i 0.0000 + 1.6835i -0.0000 - 2.5546i -0.0000 - 1.6835i +// +//Zp = +// +// -0.10199 + 0.64039i -0.03168 + 0.96777i -0.10199 - 0.64039i -0.03168 - 0.96777i -0.14368 + 0.00000i +// +//Zg = 0.0030628 + +funcprot(0); +lhs = argn(1) +rhs = argn(2) +if (rhs < 3 | rhs > 3) +error("Wrong number of input arguments.") +end + +select(rhs) + + case 3 then + if(lhs==1) + Zz = callOctave("ncauer", Rp, Rs, n) + elseif(lhs==2) + [Zz, Zp] = callOctave("ncauer", Rp, Rs, n) + elseif(lhs==3) + [Zz, Zp, Zg] = callOctave("ncauer", Rp, Rs, n) + else + error("Wrong number of output argments.") + end + end +endfunction diff --git a/macros/peak2rms.bin b/macros/peak2rms.bin Binary files differindex 4f4cb44..70f16dc 100644 --- a/macros/peak2rms.bin +++ b/macros/peak2rms.bin diff --git a/macros/pei_tseng_notch.bin b/macros/pei_tseng_notch.bin Binary files differnew file mode 100644 index 0000000..40cd414 --- /dev/null +++ b/macros/pei_tseng_notch.bin diff --git a/macros/pei_tseng_notch.sci b/macros/pei_tseng_notch.sci new file mode 100644 index 0000000..1de0fcd --- /dev/null +++ b/macros/pei_tseng_notch.sci @@ -0,0 +1,44 @@ +function [b, a] = pei_tseng_notch (frequencies, bandwidths) + +//Return coefficients for an IIR notch-filter. +//Calling Sequence +//[b, a] = pei_tseng_notch (frequencies, bandwidths) +//b = pei_tseng_notch (frequencies, bandwidths) +//Parameters +//frequencies: filter frequencies +//bandwidths: bandwidths to be used with filter +//Description +//This is an Octave function. +//It return coefficients for an IIR notch-filter with one or more filter frequencies and according bandwidths. The filter is based on a all pass filter that performs phasereversal at filter frequencies. +//This leads to removal of those frequencies of the original and phase-distorted signal. +//Examples +//sf = 800; sf2 = sf/2; +//data=[[1;zeros(sf-1,1)],sinetone(49,sf,1,1),sinetone(50,sf,1,1),sinetone(51,sf,1,1)]; +//[b,a]=pei_tseng_notch ( 50 / sf2, 2/sf2 ) +//b = +// +// 0.99213 -1.83322 0.99213 +// +//a = +// +// 1.00000 -1.83322 0.98426 + +funcprot(0); +lhs = argn(1) +rhs = argn(2) +if (rhs < 2 | rhs > 2) +error("Wrong number of input arguments.") +end + +select(rhs) + + case 2 then + if(lhs==1) + b = callOctave("pei_tseng_notch", frequencies, bandwidths) + elseif(lhs==2) + [b, a] = callOctave("pei_tseng_notch", frequencies, bandwidths) + else + error("Wrong number of output argments.") + end + end +endfunction diff --git a/macros/rceps.bin b/macros/rceps.bin Binary files differnew file mode 100644 index 0000000..ff10b98 --- /dev/null +++ b/macros/rceps.bin diff --git a/macros/rceps.sci b/macros/rceps.sci new file mode 100644 index 0000000..065e482 --- /dev/null +++ b/macros/rceps.sci @@ -0,0 +1,17 @@ +function [y, xm]= rceps(x) + +funcprot(0) +lhs= argn(1) +rhs= argn(2) + +if(rhs <1 | rhs> 1 ) +error("Wrong number of Input Arguments"); +end + +if(lhs<2 | lhs>2) +error("Wrong number of Output Arguments") +end + + [y,xm]= callOctave("rceps",x); + +endfunction diff --git a/macros/remez1.bin b/macros/remez1.bin Binary files differnew file mode 100644 index 0000000..43589d0 --- /dev/null +++ b/macros/remez1.bin diff --git a/macros/remez1.sci b/macros/remez1.sci new file mode 100644 index 0000000..aabb25e --- /dev/null +++ b/macros/remez1.sci @@ -0,0 +1,21 @@ +function b = remez1(n,f,a, varargin) + +funcprot(0); +rhs= argn(2); + +if(rhs<3 | rhs>6) +error("Wrong number of input arguments"); +end + +select(rhs) + + case 3 then + b= callOctave("remez", n,f,a); + case 4 then + b= callOctave("remez", n,f,a,varargin(1)); + case 5 then + b= callOctave("remez", n,f,a,varargin(1), varargin(2)); + case 6 then + b= callOctave("remez", n,f,a,varargin(1), varargin(2), varargin(3)); +end +endfunction diff --git a/macros/sinetone.bin b/macros/sinetone.bin Binary files differnew file mode 100644 index 0000000..0c7254b --- /dev/null +++ b/macros/sinetone.bin diff --git a/macros/sinetone.sci b/macros/sinetone.sci new file mode 100644 index 0000000..006a2e0 --- /dev/null +++ b/macros/sinetone.sci @@ -0,0 +1,20 @@ +function y= sinetone(x, varargin) + +funcprot(0); +rhs= argn(2); +if(rhs<1 | rhs>4) +error("Wrong number of input arguments") +end + +select(rhs) + case 1 then + y= callOctave("sinetone", x); + case 2 then + y= callOctave("sinetone", x , varargin(1)); + case 3 then + y= callOctave("sinetone", x , varargin(1), varargin(2)); + case 4 then + y= callOctave("sinetone", x , varargin(1), varargin(2), varargin(3)); + +end +endfunction diff --git a/macros/sinewave.bin b/macros/sinewave.bin Binary files differnew file mode 100644 index 0000000..e5535c2 --- /dev/null +++ b/macros/sinewave.bin diff --git a/macros/sinewave.sci b/macros/sinewave.sci new file mode 100644 index 0000000..d5bdfa9 --- /dev/null +++ b/macros/sinewave.sci @@ -0,0 +1,18 @@ +function y= sinewave(x, varargin) + +funcprot(0); +rhs= argn(2); +if(rhs<1 | rhs>3) +error("Wrong number of input arguments") +end + +select(rhs) + case 1 then + y= callOctave("sinewave", x); + case 2 then + y= callOctave("sinewave", x , varargin(1)); + case 3 then + y= callOctave("sinewave", x , varargin(1), varargin(2)); + +end +endfunction diff --git a/macros/spectral_adf.bin b/macros/spectral_adf.bin Binary files differnew file mode 100644 index 0000000..f0cdacf --- /dev/null +++ b/macros/spectral_adf.bin diff --git a/macros/spectral_adf.sci b/macros/spectral_adf.sci new file mode 100644 index 0000000..ea81f42 --- /dev/null +++ b/macros/spectral_adf.sci @@ -0,0 +1,18 @@ +function y= spectral_adf(x, varargin) + +funcprot(0); +rhs= argn(2); +if(rhs<1 | rhs>3) +error("Wrong number of input arguments") +end + +select(rhs) + case 1 then + y= callOctave("spectral_adf", x); + case 2 then + y= callOctave("spectral_adf", x , varargin(1)); + case 3 then + y= callOctave("spectral_adf", x , varargin(1), varargin(2)); + +end +endfunction diff --git a/macros/spectral_xdf.bin b/macros/spectral_xdf.bin Binary files differnew file mode 100644 index 0000000..78678da --- /dev/null +++ b/macros/spectral_xdf.bin diff --git a/macros/spectral_xdf.sci b/macros/spectral_xdf.sci new file mode 100644 index 0000000..fe93327 --- /dev/null +++ b/macros/spectral_xdf.sci @@ -0,0 +1,18 @@ +function y= spectral_xdf(x, varargin) + +funcprot(0); +rhs= argn(2); +if(rhs<1 | rhs>3) +error("Wrong number of input arguments") +end + +select(rhs) + case 1 then + y= callOctave("spectral_xdf", x); + case 2 then + y= callOctave("spectral_xdf", x , varargin(1)); + case 3 then + y= callOctave("spectral_xdf", x , varargin(1), varargin(2)); + +end +endfunction diff --git a/macros/spencer.bin b/macros/spencer.bin Binary files differnew file mode 100644 index 0000000..4808d26 --- /dev/null +++ b/macros/spencer.bin diff --git a/macros/spencer.sci b/macros/spencer.sci new file mode 100644 index 0000000..537ca8a --- /dev/null +++ b/macros/spencer.sci @@ -0,0 +1,15 @@ +function y= spencer(x) + +funcprot(0); + +rhs= argn(2); + +if(rhs <1 | rhs >1) +error("Wrong number of input arguments"); +end + +select(rhs) + case 1 then + y = callOctave("spencer",x); +end +endfunction diff --git a/macros/stft.bin b/macros/stft.bin Binary files differnew file mode 100644 index 0000000..6766353 --- /dev/null +++ b/macros/stft.bin diff --git a/macros/stft.sci b/macros/stft.sci new file mode 100644 index 0000000..01d8f9b --- /dev/null +++ b/macros/stft.sci @@ -0,0 +1,54 @@ +function [y,c]= stft(x, varargin) + +funcprot(0); +lhs= argn(1); +rhs= argn(2); + +if(rhs <1 | rhs>5) + error("Wrong number of input arguments"); +end + +if(lhs<1 | lhs>2) + error("Wrong number of output arguments"); +end + +select(rhs) + case 1 then + select(lhs) + case 1 then + y= callOctave("stft", x); + case 2 then + [y,c]= callOctave("stft", x); + end + case 2 then + select(lhs) + case 1 then + y= callOctave("stft", x,varargin(1)); + case 2 then + [y,c]= callOctave("stft", x, varargin(1)); + end + case 3 then + select(lhs) + case 1 then + y= callOctave("stft", x,varargin(1), varargin(2)); + case 2 then + [y,c]= callOctave("stft", x,varargin(1), varargin(2)); + end + case 4 then + select(lhs) + case 1 then + y= callOctave("stft", x,varargin(1), varargin(2), varargin(3)); + case 2 then + [y,c]= callOctave("stft", x,varargin(1), varargin(2), varargin(3)); + end + case 5 then + select(lhs) + case 1 then + y= callOctave("stft", x,varargin(1), varargin(2), varargin(3), varargin(4)); + case 2 then + [y,c]= callOctave("stft", x,varargin(1), varargin(2), varargin(3), varargin(4)); + end +end +endfunction + + diff --git a/macros/synthesis.bin b/macros/synthesis.bin Binary files differnew file mode 100644 index 0000000..e9730e4 --- /dev/null +++ b/macros/synthesis.bin diff --git a/macros/synthesis.sci b/macros/synthesis.sci new file mode 100644 index 0000000..e787c86 --- /dev/null +++ b/macros/synthesis.sci @@ -0,0 +1,16 @@ +function x= synthesis(Y,C) + +funcprot(0); +lhs= argn(1); +rhs= argn(2); + +if(rhs<2 | rhs >2) + error("Wrong number of input arguments"); +end + +select(rhs) + case 2 then + x= callOctave("synthesis", Y,C); + +end +endfunction diff --git a/macros/wconv.bin b/macros/wconv.bin Binary files differnew file mode 100644 index 0000000..f174e54 --- /dev/null +++ b/macros/wconv.bin diff --git a/macros/wconv.sci b/macros/wconv.sci new file mode 100644 index 0000000..a0682a6 --- /dev/null +++ b/macros/wconv.sci @@ -0,0 +1,33 @@ +function y = wconv (type, x, f, shape) +//Performs 1D or 2D convolution. +//Calling Sequence +//y = wconv (type, x, f) +// y = wconv (type, x, f, shape) +//Parameters +//type: convolution type. +//x: Signal vector or matrix. +//f: FIR filter coefficients. +//shape: Shape. +//Description +//This is an Octave function. +//It performs 1D or 2D convolution between the signal x and the filter coefficients f. +//Examples +//a = [1 2 3 4 5] +//b = [7 8 9 10] +//wconv(1,a,b) +//ans = +// 7 22 46 80 114 106 85 50 + +funcprot(0); +rhs = argn(2) +if(rhs<3 | rhs>4) +error("Wrong number of input arguments.") +end + +select (rhs) + case 3 then + y = callOctave("wconv",type, x, f) + case 4 then + y = callOctave("wconv",type, x, f, shape) + end +endfunction diff --git a/macros/yulewalker.bin b/macros/yulewalker.bin Binary files differnew file mode 100644 index 0000000..388c88b --- /dev/null +++ b/macros/yulewalker.bin diff --git a/macros/yulewalker.sci b/macros/yulewalker.sci new file mode 100644 index 0000000..ebcb8aa --- /dev/null +++ b/macros/yulewalker.sci @@ -0,0 +1,24 @@ +function [A,V]= yulewalker(C) + +funcprot(0); +lhs=argn(1); +rhs= argn(2); + +if(rhs<1 | rhs>1) + error("Wrong number of input arguments"); +end + +if(lhs<1 | lhs>2) + error("Wrong number of output arguments"); +end + +select(lhs) + + case 1 then + A= callOctave("yulewalker", C); + case 2 then + [A,V]= callOctave("yulewalker", C); +end +endfunction + + diff --git a/macros/zp2ss.bin b/macros/zp2ss.bin Binary files differnew file mode 100644 index 0000000..b8ab377 --- /dev/null +++ b/macros/zp2ss.bin diff --git a/macros/zp2ss.sci b/macros/zp2ss.sci new file mode 100644 index 0000000..ab14bfd --- /dev/null +++ b/macros/zp2ss.sci @@ -0,0 +1,65 @@ +function [a, b, c, d] = zp2ss (z, p, k) +//Converts zeros / poles to state space. +//Calling Sequence +//[a, b, c, d] = zp2ss (z, p, k) +//[a, b, c] = zp2ss (z, p, k) +//[a, b] = zp2ss (z, p, k) +//a = zp2ss (z, p, k) +//Parameters +//z: Zeros +//p: Poles +//k: Leading coefficient +//a: State space parameter +//a: State space parameter +//b: State space parameter +//c: State space parameter +//d: State space parameter +//Description +//This is an Octave function. +//It converts zeros / poles to state space. +//Examples +//z = [1 2 3] +// p = [4 5 6] +//k = 5 +//[a, b, c, d] = zp2ss (z, p, k) +//a = +// +// -0.00000 0.00000 -1.20000 +// -10.00000 0.00000 -7.40000 +// 0.00000 10.00000 15.00000 +// +//b = +// +// -5.7000 +// -31.5000 +// 45.0000 +// +//c = +// +// 0.00000 0.00000 1.00000 +// +//d = 5 + +funcprot(0); +lhs = argn(1) +rhs = argn(2) +if (rhs < 3 | rhs > 3) +error("Wrong number of input arguments.") +end + +select(rhs) + + case 3 then + if(lhs==1) + a = callOctave("zp2ss", z, p, k) + elseif(lhs==2) + [a, b] = callOctave("zp2ss", z, p, k) + elseif(lhs==3) + [a, b, c] = callOctave("zp2ss", z, p, k) + elseif(lhs==4) + [a, b, c, d] = callOctave("zp2ss", z, p, k) + else + error("Wrong number of output argments.") + end + end +endfunction diff --git a/macros/zp2tf.bin b/macros/zp2tf.bin Binary files differnew file mode 100644 index 0000000..2597b7d --- /dev/null +++ b/macros/zp2tf.bin diff --git a/macros/zp2tf.sci b/macros/zp2tf.sci new file mode 100644 index 0000000..c830e3d --- /dev/null +++ b/macros/zp2tf.sci @@ -0,0 +1,46 @@ +function [num, den] = zp2tf (z, p, k) +//Converts zeros / poles to a transfer function. +//Calling Sequence +//[num, den] = zp2tf (z, p, k) +//num = zp2tf (z, p, k) +//Parameters +//z: Zeros +//p: Poles +//k: Leading coefficient +//Num: Numerator of the transfer function +//den: Denomenator of the transfer function +//Description +//This is an Octave function. +//It converts zeros / poles to a transfer function. +//Examples +//z = [1 2 3] +// p = [4 5 6] +//k = 5 +//[num, den] = zp2tf (z, p, k) +//num = +// +// 5 -30 55 -30 +// +//den = +// +// 1 -15 74 -120 + +funcprot(0); +lhs = argn(1) +rhs = argn(2) +if (rhs < 3 | rhs > 3) +error("Wrong number of input arguments.") +end + +select(rhs) + + case 3 then + if(lhs==1) + num = callOctave("zp2tf", z, p, k) + elseif(lhs==2) + [num, den] = callOctave("zp2tf", z, p, k) + else + error("Wrong number of output argments.") + end + end +endfunction |