diff options
author | Abhinav Dronamraju | 2017-11-27 15:25:37 +0530 |
---|---|---|
committer | Abhinav Dronamraju | 2017-11-27 15:25:37 +0530 |
commit | b7969c62478edc84055e71df9fed140402406396 (patch) | |
tree | 048b7c76423fe27dee2e31a52bae93c95883614e /macros | |
parent | 2bb28947f9736c1c65dd338bf1bc8fcc2570b22d (diff) | |
parent | d972a68bc5b3c4c059b70e4f8cd64a64538c2be8 (diff) | |
download | FOSSEE-Signal-Processing-Toolbox-b7969c62478edc84055e71df9fed140402406396.tar.gz FOSSEE-Signal-Processing-Toolbox-b7969c62478edc84055e71df9fed140402406396.tar.bz2 FOSSEE-Signal-Processing-Toolbox-b7969c62478edc84055e71df9fed140402406396.zip |
Merge with upstream
Diffstat (limited to 'macros')
-rw-r--r-- | macros/autoreg_matrix.sci | 13 | ||||
-rw-r--r-- | macros/cceps.sci | 7 | ||||
-rw-r--r-- | macros/dwt.sci | 17 | ||||
-rw-r--r-- | macros/fftconv.sci | 15 | ||||
-rw-r--r-- | macros/fftn.sci | 15 | ||||
-rw-r--r-- | macros/filter1.sci | 34 | ||||
-rw-r--r-- | macros/filter2.sci | 18 | ||||
-rw-r--r-- | macros/fir1.sci | 19 | ||||
-rw-r--r-- | macros/fir2.sci | 19 | ||||
-rw-r--r-- | macros/ifftn.sci | 15 | ||||
-rw-r--r-- | macros/lib | bin | 6288 -> 6318 bytes | |||
-rw-r--r-- | macros/mscohere.sci | 82 | ||||
-rw-r--r-- | macros/names | 11 | ||||
-rw-r--r-- | macros/unwrap2.sci | 20 | ||||
-rw-r--r-- | macros/xcov1.sci | 18 |
15 files changed, 301 insertions, 2 deletions
diff --git a/macros/autoreg_matrix.sci b/macros/autoreg_matrix.sci new file mode 100644 index 0000000..bc36969 --- /dev/null +++ b/macros/autoreg_matrix.sci @@ -0,0 +1,13 @@ +function y = autoreg_matrix(Y, varargin) + +funcprot(0); +rhs = argn(2) +if(rhs<2 | rhs>2) +error("Wrong number of input arguments."); +end + + select(rhs) + case 2 then + y = callOctave("autoreg_matrix", Y, varargin(1)); + end +endfunction diff --git a/macros/cceps.sci b/macros/cceps.sci index 99e4a7d..8360085 100644 --- a/macros/cceps.sci +++ b/macros/cceps.sci @@ -1,5 +1,10 @@ function y = cceps (x,correct) - +//Return the complex cepstrum of the vector x +//Calling Sequence +//cceps (x) +//cceps(x, correct) +//Description +//This function return the complex cepstrum of the vector x. If the optional argument correct has the value 1, a correction method is applied. The default is not to do this. funcprot(0); // rhs = argn(2) diff --git a/macros/dwt.sci b/macros/dwt.sci new file mode 100644 index 0000000..60dc7f6 --- /dev/null +++ b/macros/dwt.sci @@ -0,0 +1,17 @@ +function [U, V] = dwt(X, varargin) + +funcprot(0); +rhs = argn(2) +if(rhs<2 | rhs>4) +error("Wrong number of input arguments."); +end + + select(rhs) + case 2 then + [U, V] = callOctave("dwt", X, varargin(1)); + case 3 then + [U, V] = callOctave("dwt", X, varargin(1), varargin(2)); + case 4 then + [U, V] = callOctave("dwt", X, varargin(1), varargin(2), varargin(3)); + end +endfunction diff --git a/macros/fftconv.sci b/macros/fftconv.sci new file mode 100644 index 0000000..4ec2815 --- /dev/null +++ b/macros/fftconv.sci @@ -0,0 +1,15 @@ +function y = fftconv(X, Y, varargin) + +funcprot(0); +rhs = argn(2) +if(rhs<2 | rhs>3) +error("Wrong number of input arguments."); +end + + select(rhs) + case 2 then + y = callOctave("fftconv", X, Y); + case 3 then + y = callOctave("ifftn",X, Y, varargin(1)); + end +endfunction diff --git a/macros/fftn.sci b/macros/fftn.sci new file mode 100644 index 0000000..ba7f352 --- /dev/null +++ b/macros/fftn.sci @@ -0,0 +1,15 @@ +function y = fftn(A, SIZE) + +funcprot(0); +rhs = argn(2) +if(rhs<1 | rhs>2) +error("Wrong number of input arguments."); +end + + select(rhs) + case 1 then + y = callOctave("fftn",A); + case 2 then + y = callOctave("fftn",A, SIZE); + end +endfunction diff --git a/macros/filter1.sci b/macros/filter1.sci new file mode 100644 index 0000000..2a17374 --- /dev/null +++ b/macros/filter1.sci @@ -0,0 +1,34 @@ +function [Y, SF] = filter1 (B, A, X, SI, DIM) + +funcprot(0); +lhs = argn(1) +rhs = argn(2) +if (rhs < 3 | rhs > 5) +error("Wrong number of input arguments.") +end + +select(rhs) + + case 3 then + if(lhs==1) + Y=callOctave("filter",B,A,X) + elseif(lhs==2) + [Y, SF] = callOctave("filter",B,A,X) + else + error("Wrong number of output arguments.") + end + case 4 then + if(lhs==2) + [Y, SF] = callOctave("filter",B,A,X,SI) + else + error("Wrong number of output arguments.") + end + case 5 then + if(lhs==2) + [Y, SF] = callOctave("filter",B,A,X,SI,DIM) + else + error("Wrong number of output arguments.") + end + + end +endfunction diff --git a/macros/filter2.sci b/macros/filter2.sci new file mode 100644 index 0000000..82f3f0b --- /dev/null +++ b/macros/filter2.sci @@ -0,0 +1,18 @@ +function Y = filter2 (B, X, SHAPE) + +funcprot(0); +lhs = argn(1) +rhs = argn(2) +if (rhs < 2 | rhs > 3) +error("Wrong number of input arguments.") +end + +select(rhs) + + case 2 then + Y=callOctave("filter2",B,X) + case 3 then + Y = callOctave("filter2",B,X,SHAPE) + end + +endfunction diff --git a/macros/fir1.sci b/macros/fir1.sci new file mode 100644 index 0000000..e3ff152 --- /dev/null +++ b/macros/fir1.sci @@ -0,0 +1,19 @@ +function B = fir1(N, W, varargin) + +funcprot(0); +rhs = argn(2) +if(rhs<2 | rhs>5) +error("Wrong number of input arguments."); +end + + select(rhs) + case 2 then + B = callOctave("fir1", N, W); + case 3 then + B = callOctave("fir1", N, W, varargin(1)); + case 4 then + B = callOctave("fir1", N, W, varargin(1), varargin(2)); + case 5 then + B = callOctave("fir1", N, W, varargin(1), varargin(2), varargin(3)); + end +endfunction diff --git a/macros/fir2.sci b/macros/fir2.sci new file mode 100644 index 0000000..418a9e4 --- /dev/null +++ b/macros/fir2.sci @@ -0,0 +1,19 @@ +function B = fir2(N, F, M, 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("fir2", N, F, M); + case 4 then + B = callOctave("fir2", N, F, M, varargin(1)); + case 5 then + B = callOctave("fir2", N, F, M, varargin(1), varargin(2)); + case 6 then + B = callOctave("fir2", N, F, M, varargin(1), varargin(2), varargin(3)); + end +endfunction diff --git a/macros/ifftn.sci b/macros/ifftn.sci new file mode 100644 index 0000000..269a77d --- /dev/null +++ b/macros/ifftn.sci @@ -0,0 +1,15 @@ +function y = ifftn(A, varargin) + +funcprot(0); +rhs = argn(2) +if(rhs<1 | rhs>2) +error("Wrong number of input arguments."); +end + + select(rhs) + case 1 then + y = callOctave("ifftn",A); + case 2 then + y = callOctave("ifftn",A, varargin(1)); + end +endfunction Binary files differdiff --git a/macros/mscohere.sci b/macros/mscohere.sci new file mode 100644 index 0000000..357da58 --- /dev/null +++ b/macros/mscohere.sci @@ -0,0 +1,82 @@ +function [PXX, FREQ] = mscohere (X, Y, WINDOW, OVERLAP, NFFT, FS, RANGE) +//It estimate (mean square) coherence of signals x and y. +//Calling Sequence +//[Pxx, freq] = mscohere (x, y) +//[Pxx, freq] = mscohere (x, y, window) +//[Pxx, freq] = mscohere (x, y, window, overlap) +//[Pxx, freq] = mscohere (x, y, window, overlap, Nfft) +//[Pxx, freq] = mscohere (x, y, window, overlap, Nfft, Fs) +//[Pxx, freq] = mscohere (x, y, window, overlap, Nfft, Fs, range) +//mscohere (...) +//Description +//This function estimate (mean square) coherence of signals x and y. +//Examples +//[Pxx, freq] = mscohere(4,5) +//ans = +//PXX = +// Nan +// 1 +//FREQ = +// 0 +// 0.5 +funcprot(0); +lhs = argn(1) +rhs = argn(2) +if (rhs < 2 | rhs > 7) +error("Wrong number of input arguments.") +end + +select(rhs) + + case 2 then + if(lhs==0) + callOctave("mscohere",X,Y) + elseif(lhs==2) + [PXX, FREQ] = callOctave("mscohere",X,Y) + else + error("Wrong number of output arguments.") + end + + case 3 then + if(lhs==0) + callOctave("mscohere",X,Y,WINDOW) + elseif(lhs==2) + [PXX, FREQ] = callOctave("mscohere",X,Y,WINDOW) + else + error("Wrong number of output arguments.") + end + case 4 then + if(lhs==0) + callOctave("mscohere",X,Y,WINDOW,OVERLAP) + elseif(lhs==2) + [PXX, FREQ] = callOctave("mscohere",X,Y,WINDOW,OVERLAP) + else + error("Wrong number of output arguments.") + end + case 5 then + if(lhs==0) + callOctave("mscohere",X,Y,WINDOW,OVERLAP,NFFT) + elseif(lhs==2) + [PXX, FREQ] = callOctave("mscohere",X,Y,WINDOW,OVERLAP,NFFT) + else + error("Wrong number of output arguments.") + end + case 6 then + if(lhs==0) + callOctave("mscohere",X,Y,WINDOW,OVERLAP,NFFT,FS) + elseif(lhs==2) + [PXX, FREQ] = callOctave("mscohere",X,Y,WINDOW,OVERLAP,NFFT,FS) + else + error("Wrong number of output arguments.") + end + case 7 then + if(lhs==0) + callOctave("mscohere",X,Y,WINDOW,OVERLAP,NFFT,FS,RANGE,) + elseif(lhs==2) + [PXX, FREQ] = callOctave("mscohere",X,Y,WINDOW,OVERLAP,NFFT,FS,RANGE) + else + error("Wrong number of output arguments.") + end + end +endfunction + diff --git a/macros/names b/macros/names index f227bbd..c6a8d88 100644 --- a/macros/names +++ b/macros/names @@ -5,6 +5,7 @@ arburg arcov armcov aryule +autoreg_matrix barthannwin bartlett besselap @@ -52,6 +53,7 @@ downsample dst1 durbinlevinson dutycycle +dwt ellip ellipap ellipord @@ -60,13 +62,18 @@ eqtflength falltime fft fft2 +fftconv fftfilt -fftshift1 +fftn fht +filter1 +filter2 filternorm filtfilt filtic filtord +fir1 +fir2 firpmord firtype flattopwin @@ -132,6 +139,7 @@ midcross modulate morlet movingrms +mscohere musicBase ncauer nnls @@ -223,6 +231,7 @@ udecode uencode ultrwin unshiftdata +unwrap2 upfirdn upsample upsamplefill diff --git a/macros/unwrap2.sci b/macros/unwrap2.sci new file mode 100644 index 0000000..5b19283 --- /dev/null +++ b/macros/unwrap2.sci @@ -0,0 +1,20 @@ +function Y = unwrap2 (X, TOL, DIM) + +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 + Y = callOctave("unwrap",X) + case 2 then + Y = callOctave("unwrap",X,TOL) + case 3 then + Y = callOctave("unwrap",X,TOL,DIM) + end + +endfunction diff --git a/macros/xcov1.sci b/macros/xcov1.sci index 4c1f37e..b0bff93 100644 --- a/macros/xcov1.sci +++ b/macros/xcov1.sci @@ -1,4 +1,22 @@ function [R,lag] = xcov1(X, Y, biasflag) +// Compute covariance at various lags [=correlation(x-mean(x),y-mean(y))]. +//Calling Sequence +//[R, lag] = xcov (X) +//... = xcov (X, Y) +//... = xcov (..., maxlag) +//... = xcov (..., scale) +//Parameters +//X: Input vector +//Y: if specified, compute cross-covariance between X and Y, otherwise compute autocovariance of X. +//maxlag: is specified, use lag range [-maxlag:maxlag], otherwise use range [-n+1:n-1]. +//scale: +// 'biased': for covariance=raw/N, +// 'unbiased': for covariance=raw/(N-|lag|), +// 'coeff': for covariance=raw/(covariance at lag 0), +// 'none': for covariance=raw +// 'none': is the default. +//Description +//Compute covariance at various lags [=correlation(x-mean(x),y-mean(y))]. Returns the covariance for each lag in the range, plus an optional vector of lags. funcprot(0); rhs = argn(2) |