Markov processing and Eigenvectors
2 views (last 30 days)
Show older comments
Hello I am trying to compute the eigenvectors and eigenvalues of the transition matrix . And plot the limiting distribution
And here my attempt to solve it.
I could not got the correct eignvalue and the correct plot. I think I need to normalize it but it's not work with me.
Thaks in advance!
input=fileread('amino.txt');
Amino=['A', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'K', 'L', 'M', 'N', 'P', 'Q', 'R', 'S', 'T', 'V', 'W', 'Y', '$'];
Amino=Amino';
n=size(Amino);
total=0;
for i=1:size(Amino)
List(i)=length(strfind(input,Amino(i)));
end
List=List';
%normalize
% List_sum=sum(List);
% for i=1:size(List)
% List(i)=List(i)/List_sum;
%
% end
for i=1:size(Amino)
for j=1:size(Amino)
f=strcat(Amino(i),Amino(j))
result(j,i)= length(strfind(input,strcat (Amino(i),Amino(j))))/List(i);
end
end
% normalize
List_sum=sum(List);
for i=1:size(List)
List(i)=List(i)/List_sum;
end
Cond_prob=0;
for i=1:length(result)
Calc_ent=0;
for j=1:length(result)
Calc_ent=Calc_ent+result(j,i)*log2(result(j,i));
end
Cond_prob=Cond_prob+res(i)*Calc_ent;
end
Cond_prob=-Cond_prob;
2 Comments
Walter Roberson
on 25 Sep 2019
See also user question at https://www.mathworks.com/matlabcentral/answers/482005-probability-of-markov-process
Answers (1)
See Also
Categories
Find more on Markov Chain Models in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!