开发者

Matlab: correlation number

开发者 https://www.devze.com 2023-01-11 20:00 出处:网络
I have a 开发者_高级运维2 vectors of numbers of either 1 or -1. What are the standard tools on Matlab that would help me calculate a correlation number between the two vectors? Thanks in advance!The c

I have a 开发者_高级运维2 vectors of numbers of either 1 or -1. What are the standard tools on Matlab that would help me calculate a correlation number between the two vectors? Thanks in advance!


The corr function in matlab would switch to Phi-coefficient if it sees binary data.


The CORRCOEF function is what you're looking for:

R = corrcoef(vector1(:),vector2(:));  %# Returns a 2-by-2 matrix of
                                      %#   correlation coefficients

If you have the Statistics Toolbox, you may also want to check out the function CORR:

RHO = corr(vector1(:),vector2(:));  %# Returns the linear correlation coefficient
                                    %#   (default is a Pearson correlation)
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号