diff options
author | Sunil Shetye | 2018-07-25 16:27:51 +0530 |
---|---|---|
committer | Sunil Shetye | 2018-07-26 23:50:17 +0530 |
commit | 9ca7882cee16ad48b18df989e8300c697010e55a (patch) | |
tree | 59e0c6116b835ae3e5e3208bc9609ed2828069ed /macros/xcorr1.sci | |
parent | 6bbb00d0f0128381ee95194cf7d008fb6504de7d (diff) | |
download | FOSSEE-Signal-Processing-Toolbox-9ca7882cee16ad48b18df989e8300c697010e55a.tar.gz FOSSEE-Signal-Processing-Toolbox-9ca7882cee16ad48b18df989e8300c697010e55a.tar.bz2 FOSSEE-Signal-Processing-Toolbox-9ca7882cee16ad48b18df989e8300c697010e55a.zip |
code changes by Sonu Sharma during FOSSEE Fellowship 2018
Diffstat (limited to 'macros/xcorr1.sci')
-rw-r--r-- | macros/xcorr1.sci | 86 |
1 files changed, 0 insertions, 86 deletions
diff --git a/macros/xcorr1.sci b/macros/xcorr1.sci deleted file mode 100644 index 6ae884d..0000000 --- a/macros/xcorr1.sci +++ /dev/null @@ -1,86 +0,0 @@ -function [R, lag] = xcorr1 (X, Y, maxlag, scale) -//Estimates the cross-correlation. -//Calling Sequence -//[R, lag] = xcorr1 (X, Y, maxlag, scale) -//[R, lag] = xcorr1 (X, Y, maxlag) -//[R, lag] = xcorr1 (X, Y) -//Parameters -//X: [non-empty; real or complex; vector or matrix] data. -//Y: [real or complex vector] data. -// If X is a matrix (not a vector), Y must be omitted. Y may be omitted if X is a vector; in this case xcorr estimates the autocorrelation of X. -//maxlag: [integer scalar] maximum correlation lag If omitted, the default value is N-1, where N is the greater of the lengths of X and Y or, if X is a matrix, the number of rows in X. -//scale: [character string] specifies the type of scaling applied to the correlation vector (or matrix). is one of: -// ‘none’ - return the unscaled correlation, R, -//‘biased’ - return the biased average, R/N, -//‘unbiased’ - return the unbiased average, R(k)/(N-|k|), -//‘coeff’ - return the correlation coefficient, R/(rms(x).rms(y)), where "k" is the lag, and "N" is the length of X. If omitted, the default value is "none". If Y is supplied but does not have the same -// length as X, scale must be "none". -//Description -//This is an Octave function. -//Estimate the cross correlation R_xy(k) of vector arguments X and Y or, if Y is omitted, estimate autocorrelation R_xx(k) of vector X, for a range of lags k specified by argument "maxlag". If X is a -//matrix, each column of X is correlated with itself and every other column. -// -//The cross-correlation estimate between vectors "x" and "y" (of length N) for lag "k" is given by -// -// N -// R_xy(k) = sum x_{i+k} conj(y_i), -// i=1 -// -//where data not provided (for example x(-1), y(N+1)) is zero. Note the definition of cross-correlation given above. To compute a cross-correlation consistent with the field of statistics, see xcov. -//Examples -//[R, lag] = xcorr1 ( [5 5], [2 2], 2, 'biased' ) -// -//R = -// -// 0 5 10 5 0 -// -//lag = -// -// -2 -1 0 1 2 - -funcprot(0); -lhs = argn(1) -rhs = argn(2) -if (rhs < 1 | rhs > 4) -error("Wrong number of input arguments.") -end - -select(rhs) - - case 2 then - if(lhs==1) - R = callOctave("xcorr", X) - elseif(lhs==2) - [R, lag] = callOctave("xcorr", X) - else - error("Wrong number of output argments.") - end - - case 2 then - if(lhs==1) - R = callOctave("xcorr", X, Y) - elseif(lhs==2) - [R, lag] = callOctave("xcorr", X, Y) - else - error("Wrong number of output argments.") - end - - case 3 then - if(lhs==1) - R = callOctave("xcorr", X, Y, maxlag) - elseif(lhs==2) - [R, lag] = callOctave("xcorr", X, Y, maxlag) - else - error("Wrong number of output argments.") - end - case 4 then - if(lhs==1) - R = callOctave("xcorr", X, Y, maxlag, scale) - elseif(lhs==2) - [R, lag] = callOctave("xcorr", X, Y, maxlag, scale) - else - error("Wrong number of output argments.") - end - - end -endfunction |