Scilab Function
Last update : 28/10/2005
corrcoeff - Correlation Coefficient
calculation
Calling Sequence
-
R = corrcoeff(x,y)
Parameters
-
x
: When two rhs arguments are used (x and y), x is a vector and
has the same length as y. If only one rhs argument is used (no y),
then x must be a matrix with at least two columns.
-
y
: a vector with the same length as x
-
R
: the correlation coefficient. If two rhs arguments are used, R
is a scalar. If two rhs arguments are used, R is a square matrix
with so many columns as the input matrix x. the element r(i,j)
equals the correlation coefficient between signal i and signal j
(columns i and j of input matrix x).
Description
-
The calculation of the correlation coefficients is done in the time
area. Especially, when only one rhs is used, the strength of SciLab,
MatLab or Octave can be seen:
-
In the sci-function, the correlation coefficient is calculated by:
zm1=x - meshgrid(mean(x,'r'),1:1:N); W0=(zm1.')*zm1;
W1=sqrt(diag(W0)*diag(W0).'); R=W0 ./W1;
Examples
X=rand(1000,100,'normal');
R=corrcoeff(X);
k=0:1:99;
plot2d(k,diag(R));
xclick();
xbasc();
plot2d(k,diag(R,1));
See Also
akfrader
,
meshgrid
,
Authors
-
Dr. Andreas Geissler geisslea@web.de
Used Function
meshgrid