At present, it is unclear what is the reason, how much influence, only know the existence of this problem.
Run version:
1.matlabr2015b Windows64bit
2.https://octave-online.net/
3.http://www.compileonline.com/execute_matlab_online.php
Code:
The% self-compiled covariance matrix calculation method is consistent, but inconsistent with the COV function of Matlab rxx.mclose all;clear;clc;rng (' Default '); rng (0); A = Randn (10,4); [R,c]=size (A);% method 1rxx1=a ' *a/r;%method2for n=1:r rx2_0 (:,:, N) =a (n,:) ' *a (n,:); Endrxx2=sum (rx2_0,3)/r;% method 3rxx3=cov (A); fprintf (' err1=%f\n ', Sumsqr (rxx1-rxx2)); fprintf (' err2=%f\n ', Sumsqr (rxx1-rxx3)); fprintf (' err3=%f\n ') , SUMSQR (RXX2-RXX3));
Results
ERR1 close to 0,err2,err3 equal and equal to a certain number, compared with the corresponding matrix data, there are indeed differences.
todo~.~
[Matlab] covariance matrix calculation using the COV function results inconsistent with the self-programmed results