How would i display a matrix as a graph?

조회 수: 3 (최근 30일)
Feliciano Döring
Feliciano Döring 2018년 10월 23일
댓글: Feliciano Döring 2018년 10월 29일
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
Feliciano Döring
Feliciano Döring 2018년 10월 24일
The plot doesn't quite fit. But here take a look
Feliciano Döring
Feliciano Döring 2018년 10월 24일
Yes, something like this

댓글을 달려면 로그인하십시오.

채택된 답변

jonas
jonas 2018년 10월 24일
편집: jonas 2018년 10월 24일
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
jonas
jonas 2018년 10월 29일
I believe I adressed this in the original answer?
y = A(j,:)./scale+(size(A,1)-j);
Feliciano Döring
Feliciano Döring 2018년 10월 29일
Sorry, didn't pay attention '-.-

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Mathematics에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by