corr2 return 1 for different value

4 views (last 30 days)
khalida basheer
khalida basheer on 20 Sep 2020
Commented: khalida basheer on 21 Sep 2020
why when i use corr2 for different value in matlab return result=1 although the tow matrix not similar like this:-
aa =
137.5093 1.9847
>> bb
bb =
141.2252 3.3757
>> corr2(aa,bb)
ans =

Answers (1)

Ameer Hamza
Ameer Hamza on 20 Sep 2020
If you use only 2D vectors with corr2(), it is always possible to draw a line connecting two points, so the correction coefficient is always 1 or -1. You can verify this by simplifying the formula: for the case when x and y are 2D vectors.
khalida basheer
khalida basheer on 21 Sep 2020
Sir Walter Roberson, actually the problem is the second feature, after deleting it and relying on other features, I got the acceptable result
thank you very much

Sign in to comment.


Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by