Difference in results when running the different version but simple script.
1 次查看(过去 30 天)
显示 更早的评论
I make my own script about calculating the transition probability of Markov Chain.I run the two scripts and get different results.Can you detect what makes the difference? What I was doing is
[t,j]=size(sets);
p00=zeros(j,1);
p01=zeros(j,1);
p10=zeros(j,1);
p11=zeros(j,1);
for i=1:j,
prev=sets(1:t-1,i);
next=sets(2:t,i);
p00(i)=sum(prev <= 1 & next <= 1)/sum(sets<=1);
p01(i)=sum(prev <= 1 & next > 1)/sum(sets<=1);
p10(i)=sum(prev > 1 & next <= 1)/sum(sets>1);
p11(i)=sum(prev > 1 & next > 1)/sum(sets>1);
end
Another very similiar version is
for i=1:nv,
s0=sequence(1:nt-1,i);
s1=sequence(2:nt,i);
ndry=length(find(s0 <= threshold));
nwet=length(find(s0 > threshold));
p00(i)=length(find(s0 <= threshold & s1 <= threshold))/ndry;
p01(i)=length(find(s0 <= threshold & s1 > threshold))/ndry;
p10(i)=length(find(s0 > threshold & s1 <= threshold))/nwet;
p11(i)=length(find(s0 > threshold & s1 > threshold))/nwet;
end
0 个评论
回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!