フィルターのクリア

Difference in results when running the different version but simple script.

1 回表示 (過去 30 日間)
Joy Tian
Joy Tian 2015 年 10 月 18 日
編集済み: Walter Roberson 2015 年 10 月 19 日
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 件)

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by