MATLAB: How to implement this equation

equation

I have a equation,kindly tell how to implement this equation

Best Answer

hi,
given I and J of size MxN
M=6;N=4;
I=rand(M,N);
J=rand(M,N);
II=I.^2;
JJ=J.^2;
P=I.*J; % its Element wise product !!
numerator=sum(P(:));
denominator= sqrt(sum(II(:))*sum(JJ(:)));
NCC=numerator/denominator;
the result should be : 0<=NCC<=1,