Markov processing and Eigenvectors

2 次查看(过去 30 天)
Brave A
Brave A 2019-9-25
编辑: Brave A 2019-9-26
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;

回答(1 个)

Brave A
Brave A 2019-9-25
Any thoughts?

类别

Help CenterFile Exchange 中查找有关 Markov Chain Models 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by