COMPGROUPS.NET | Search | Post Question | Groups | Stream | About | Register

### missing 1/NM in corr2 documentation?

• Email
• Follow

```Should there be a 1/NM term inside the square root in the corr2 documentation?

r = corr(A,B)/(std(A) std(B)), so each double sum in the denominator is supposed to be a variance, so they should be divided by NM, right?

Thanks,
Dave
```
 0
Reply daviddoria (340) 5/8/2009 8:54:01 PM

See related articles to this posting

```Hi David, I think the documentation is correct, there is a term inside each of the square roots in the denominator, but there is also a 1/NM term in the numerator for the covariance

1/NM/(sqrt(1/NM)*sqrt(1/NM))

so they cancel

a = a - mean2(a); %zero mean
b = b - mean2(b); %zero mean
r = sum(sum(a.*b))/sqrt(sum(sum(a.*a))*sum(sum(b.*b)));

hope that helps,
wayne

"David Doria" <daviddoria@gmail.com> wrote in message <gu2659\$eeq\$1@fred.mathworks.com>...
> Should there be a 1/NM term inside the square root in the corr2 documentation?
>
> r = corr(A,B)/(std(A) std(B)), so each double sum in the denominator is supposed to be a variance, so they should be divided by NM, right?
>
> Thanks,
> Dave
```
 0
Reply wmkingty (1430) 5/12/2009 3:19:02 PM

1 Replies
38 Views

Similar Articles

12/5/2013 9:52:08 PM
[PageSpeed]