please check it ..this is another eqn<http://latex.codecogs.com/gif.latex?P1v(i,j)=\frac{{\sum_{u=1}^{^{S_{u}-1}}\sum_{v=1}^{S_{v}-1}\delta%20({F_{h}(u,v)=i,{F_{h}(u,v+1)=j}})}}{\sum_{u=1}^{{S_{u}-1}}\sum_{v=1}^{S_{v}-1}\delta%20(F_{h}(u,v)=i)}>..... i wrote code for this eqn is p1v=zeros(9); for ii=1:9 p1=Yh(1:end-1,:)==ii; for jj=1:9 p2=Yh(:,2:end-1)==jj; p1v(ii,jj) = nnz(p1 & p2)./nnz(p1); end end ...is it correct ?
this code is not working for transition probability matrix ....make it correct?
1 回表示 (過去 30 日間)
古いコメントを表示
my transition probability matrix equation is given under link. http://latex.codecogs.com/gif.latex?p1_{h}(i,j)=\frac{\sum_{u=1}^{S_{u}-2}\sum_{v=1}^{S_{v}}\delta%20(F_{h}(u,v)=i,{F_{h}}(u+1,v)=j)}{\sum_{u=1}^{^{S_{u}-2}}%20\sum_{v=1}^{^{S_{v}}}\delta%20({F_{h}(u,v)=i})}
for this eqn i wrote code given below
sv=128;
su=128;
for i=1:9
for j=1:9
a(i,j)=0;
for u=1:su-2
for v=1:sv
if (Yh(u,v)==i && Yh(u+1,v)==j)
dell=1;
else
dell=0;
end
a(i,j)=a(i,j)+dell;
b(i,j)=0;
if(Yh(u,v)==i)
dell1=1;
else
dell1=0;
end
b(i,j)=b(i,j)+dell1;
end
end
end
end
.....the final result want to know for above code is p=a./b.... and here the dell value as considered as dell(.)=1 if and only if its argumens are satisfied, otherwise dell(.)=0.
2 件のコメント
Jan
2013 年 1 月 17 日
What does "is not working" mean? Do you get an error message or do the results differ from your expectations?
回答 (2 件)
Walter Roberson
2013 年 1 月 11 日
Why are you setting b(i,j)=0 inside each "for v" iteration ?
0 件のコメント
Andrei Bobrov
2013 年 1 月 11 日
編集済み: Andrei Bobrov
2013 年 1 月 11 日
p1h = zeros(9);
for ii = 1:9
p1 = Yh(1:end-2,:) == ii;
for jj = 1:9
p2 = Yh(2:end-1,:) == jj;
p1h(ii,jj) = nnz(p1 & p2)./nnz(p1);
end
end
2 件のコメント
参考
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!