How would i display a matrix as a graph?
6 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Feliciano Döring
le 23 Oct 2018
Commenté : Feliciano Döring
le 29 Oct 2018
I have a matrix in which the values are mainly in the main diagonal. What i want to do is create a bigger matrix in which each row of the matrix is a line so it would show the values of each row across several lines. So for example if i have an identity 3x3 matrix, it would be three lines with spikes on the main diagonal.
13 commentaires
Réponse acceptée
jonas
le 24 Oct 2018
Modifié(e) : jonas
le 24 Oct 2018
Here's a custom plot type I made. It may look upside down, but the value on the y-axis denotes the row number. The "peak value" of the lines are scaled and only show relative height.
A = eye(5);
scale = 2;
figure;hold on
for j = 1:size(A,1);
y = A(j,:)./scale+j;
fill([1 1:size(A,1) size(A,1)],[min(y) y min(y)],'r');
end
If you prefer the reverse order, as they appear in the matrix, then just change the 5th line to
y = A(j,:)./scale+(size(A,1)-j);
5 commentaires
jonas
le 29 Oct 2018
I believe I adressed this in the original answer?
y = A(j,:)./scale+(size(A,1)-j);
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Formatting and Annotation dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!