I want to plot the state transitions chain of markov process. My original state transitions matrix is 56 by 1000. But here I give a small example
for example, if I have to plot this matrix, where each column represents discrete lifetime for one individual.
sequence = [1 1 1 1 2 2 2 2 2 3;...
1 1 1 1 1 1 1 1 1 1;...
1 1 1 1 1 1 1 1 1 1;...
1 1 1 1 1 1 1 2 2 2;...
1 1 1 1 1 1 1 1 1 1;...
2 2 2 2 2 2 2 2 2 2; ...
2 2 2 2 2 2 2 3 3 3; ...
2 3 3 3 3 3 2 2 2 2; ...
2 2 2 2 2 2 4 4 4 4]
age = (25:33)
How can I put on x axis the age variable and y axis the matrix sequence columnwise?

 採用された回答

Alan Moses
Alan Moses 2021 年 2 月 26 日

1 投票

You may use the following line of code:
plot(age,sequence(:,1:end))
To create labels for the lines plotted, you may use the legend function.

1 件のコメント

susman
susman 2021 年 3 月 3 日
Thank you, that worked perfectly!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

質問済み:

2021 年 2 月 23 日

コメント済み:

2021 年 3 月 3 日

Community Treasure Hunt

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

Start Hunting!

Translated by