Measure the coherence (or incoherence) of two/one matrix/ces
11 ビュー (過去 30 日間)
古いコメントを表示
Dear all I would like to ask you if there is in matlab a fuction that based on two/one input matrices to calculate the coherence or incoherence between those two or the mutual coherence of itself.
I would like to thank you in advance for your help
Regards Alex
0 件のコメント
回答 (2 件)
Wayne King
2012 年 2 月 9 日
For a single matrix, X, compute
X'*X
and then find the largest absolute value not on the main diagonal.
X = randn(4,4);
X = X/(diag(sqrt(diag(X'*X))));
mcoh = abs(X'*X);
V = diag(mcoh);
V = -diag(V,0);
mcoh = mcoh+V;
max(max(mcoh))
You want to normalize the column vectors in X to have unit norm first.
Pushkar Khatri
2018 年 5 月 30 日
For the mutual coherence of a single matrix, you can make your own function and implement it later in command line. Here is my function(I had used the convention X*X' for my purpose, you can use change it to X'*X) :-
function z = mutual_coherence(X)
[m,n] = size(X);
for i =1:m
d1 = norm(X(i,:));
for j =1:m
d2 = norm(X(j,:));
if i ==j
continue;
else
z = max((sqrt((X(i,:)*X(j,:)')^2 ))/(d1*d2));
end
end
end
end
2 件のコメント
Kobi
2019 年 4 月 13 日
about your function
what if the number of rows is different then the number of columns?
n is unused.
Pushkar Khatri
2019 年 4 月 13 日
編集済み: Pushkar Khatri
2019 年 4 月 13 日
As per the function, it finds out the mutual coherence of a single matrix X. So for that you need to find the matrix multiplication of X with its transpose. In my function number of rows and columns are different. if you do X * X' , you'll get m by m matrix and if you do X' * X you'll get n by n matrix. The point is not to loose the importanat information. So if m>n, find coherence using rows(i.e m) { in this way, you get coherence for m*n elements and rest of the elements out of total m*m elements will be zero },
else if n>m , use n instead of m in the function.
Does that clear your doubt?
参考
カテゴリ
Help Center および File Exchange で Creating and Concatenating Matrices についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!