Measure the coherence (or incoherence) of two/one matrix/ces

12 次查看(过去 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

回答(2 个)

Wayne King
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
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
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
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 CenterFile Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by