what kind of plot is useful for comparing two matrices?
Mostra commenti meno recenti
I have two 5*5 matrices. I want to use a plot to show that they are close element-wise.
What plot is suitable?
I think the plot should be transparent.
It is of course doable if we reshape the matrices into vectors, and use a 2d plot. But that is not intuitive.
Risposta accettata
Più risposte (1)
Image Analyst
il 9 Giu 2024
Modificato: Image Analyst
il 10 Giu 2024
Why a plot and not a 2-D image showing differences? What would your x axis represent?
If you treat your matrix as an image there are lots of ways to compare images. For example imabsdiff, immse, psnr, etc. For example you could use imabsdiff and color code the magnitude of the differences in an image, or you could count the number of matches and mismatches. You could also make a histogram of the differences - that's a plot.
immse and psnr give single numbers gauging how close the matrices are to each other.
Here's some code
% Create two matrices
m1 = uint8(randi(255, 5, 5))
m2 = uint8(randi(255, 5, 5))
% Compute difference.
diffMatrix = imabsdiff(m1, m2)
% Display m1
subplot(2, 2, 1);
imshow(m1)
title('m1');
% Display m2
subplot(2, 2, 2);
imshow(m2)
title('m2');
% Display diffMatrix
p3 = subplot(2, 2, 3);
imshow(diffMatrix)
title('diffMatrix');
colorbar(p3)
colormap(p3, 'turbo')
Categorie
Scopri di più su Annotations in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


