Markov processing and Eigenvectors

3 views (last 30 days)
Brave A
Brave A on 25 Sep 2019
Edited: Brave A on 26 Sep 2019
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;

Answers (1)

Brave A
Brave A on 25 Sep 2019
Any thoughts?

Community Treasure Hunt

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

Start Hunting!