poster
2019-12-10, 20:48
我有2个数字,分别为1或-1。 Matlab上有哪些标准工具可以帮助我计算两个向量之间的相关数?提前致谢!
回答:
您需要的是CORRCOEF (http://www.mathworks.com/access/helpdesk/help/techdoc/ref/corrcoef.html)函数:
R = corrcoef(vector1(:),vector2(:)); %# Returns a 2-by-2 matrix of %# correlation coefficients 如果您具有统计工具箱 (http://www.mathworks.com/access/helpdesk/help/toolbox/stats/) ,则可能还需要检出CORR (http://www.mathworks.com/access/helpdesk/help/toolbox/stats/corr.html)函数:
RHO = corr(vector1(:),vector2(:)); %# Returns the linear correlation coefficient %# (default is a Pearson correlation)
更多&回答... (https://stackoverflow.com/questions/3507669)
回答:
您需要的是CORRCOEF (http://www.mathworks.com/access/helpdesk/help/techdoc/ref/corrcoef.html)函数:
R = corrcoef(vector1(:),vector2(:)); %# Returns a 2-by-2 matrix of %# correlation coefficients 如果您具有统计工具箱 (http://www.mathworks.com/access/helpdesk/help/toolbox/stats/) ,则可能还需要检出CORR (http://www.mathworks.com/access/helpdesk/help/toolbox/stats/corr.html)函数:
RHO = corr(vector1(:),vector2(:)); %# Returns the linear correlation coefficient %# (default is a Pearson correlation)
更多&回答... (https://stackoverflow.com/questions/3507669)