How to calcuate the beta metrics?
The correct code is 

metrics.Beta = sum(sum((I1 - I_1).*(I2 - I_2)))./(sqrt(sum(sum((I1 - I_1).^2))).*(sum(sum((I2 - I_2).^2))));


The reference you have shown is incorrect, reffr paper:


  2013 August Gregorio - ‘A suitable threshold for speckle reduction in
  ultrasound images’,  IEEE transactions on instrumentations and
  measurement