correlation between binary strings
    6 次查看(过去 30 天)
  
       显示 更早的评论
    
hi everyone I want to find the correlation between these two binary strings x and y 
x=[1111111111111111111111111111111111111111111111111111111111111111];
y=[1000000001011001010110111110010101011010010000100010111101111110];
using the formula attached as figure. the value of E is 0.05 or 50%. 
Thank you in advance  
1 个评论
回答(2 个)
  Maria Imdad
 2021-4-9
        
      编辑:Maria Imdad
 2021-4-9
  
      2 个评论
  Walter Roberson
      
      
 2021-4-9
				If the values are represented by 0 and 1, then it seems to me using 0.5 would make more sense...
  Walter Roberson
      
      
 2021-4-9
        R = sum((x - E).*(y - E)) ./ (sqrt(sum((x-E).^2)) .* sqrt(sum((y-E).^2)));
2 个评论
  Walter Roberson
      
      
 2021-4-9
				It handles all of x and all of y, assuming that they are the same size. It uses vector operations so it does not need to loop. The sigma operation in the equation is sum() here.
另请参阅
类别
				在 Help Center 和 File Exchange 中查找有关 Particle & Nuclear Physics 的更多信息
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!