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

12 visualizzazioni (ultimi 30 giorni)
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

Risposte (2)

Wayne King
Wayne King il 9 Feb 2012
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 il 30 Mag 2018
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 Commenti
Kobi
Kobi il 13 Apr 2019
about your function
what if the number of rows is different then the number of columns?
n is unused.
Pushkar Khatri
Pushkar Khatri il 13 Apr 2019
Modificato: Pushkar Khatri il 13 Apr 2019
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?

Accedi per commentare.

Categorie

Scopri di più su Creating and Concatenating Matrices in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by