Markov processing and Eigenvectors
2 次查看(过去 30 天)
显示 更早的评论
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 个评论
Walter Roberson
2019-9-25
See also user question at https://www.mathworks.com/matlabcentral/answers/482005-probability-of-markov-process
回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Markov Chain Models 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!