how can we find the percentage of similarity between two matrices ??

3 ビュー (過去 30 日間)
NAVNEET NAYAN
NAVNEET NAYAN 2017 年 2 月 22 日
回答済み: Walter Roberson 2017 年 2 月 22 日
i have two 1280-by-720 matrices. after looking the elements of those two matrices, both appears nearly equal. please tell me how can i find the percentage of similarity or equality between two matrices. i have found correlation coefficient method to find similarity between those two matrices, so can anyone suggest any different way to do the same.
Navneet Nayan

回答 (2 件)

KSSV
KSSV 2017 年 2 月 22 日
How about the below logic?
m = 1280 ; n = 720 ; % your dimensions
p = 1000 ;
a = rand(m,n) ; % a random matrix
b = rand(m,n) ; % a random matrix
idx = randsample(1:m*n,p) ; % deliberately making p elements in a and b equal
a(idx) = b(idx) ;
%
k = a==b ; % get the equal elements
iwant = sum(k(:)); % total number of equal elements, I will get it as p (i fixed it earlier)
percentage = iwant/(m*n)*100
In your case, a and b are matrices which already have equal elements. If == is not working try with ismemebr, ismemebrtol.

Walter Roberson
Walter Roberson 2017 年 2 月 22 日
MSE, mean squared error. You might be able to use immse()

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by