📄 cvar.m
字号:
function c = cvar(x,y,z)%CVAR Covariance.%% c = cvar(x,y)%% The covariance is computed between all columns in x and % all columns in y. If only one argument x is given then % the covariance matrix for x is returned instead, i e% the result is the same as for the call cvar(x,x).%% See also CORR, SPEARMAN.% GPL Copyright (c) Anders Holtsberg, 1998, 1999if nargin < 2 if size(x,1) == 1 x = x'; end n = size(x,1); m = mean(x); x = x-m(ones(n,1),:); c = (x'*x)/(n-1);else if size(x,1) == 1 x = x'; end if size(y,1) == 1 y = y'; end n = size(x,1); mx = mean(x); my = mean(y); x = x-mx(ones(n,1),:); y = y-my(ones(n,1),:); c = (x'*y)/(n-1); end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -