code running endlessly without stopping
Show older comments
I have the below Matlab code and it has been running endlessly without stopping. I have checked and could not detect any error on it.
% specify upper bound.
Iu=1;
% specify lower bound
IL=0;
% specify the probility matrix
Pyc = [0.9 0.05 0.05; 0.05 0.9 0.05; 0.05 0.05 0.9];
% specify the error
e = 0.008;
[N,M]=size(Pyc);
Pc=(1/M).*ones(M,1);
Qy=Pyc*Pc;
F=zeros (1,M);
while (Iu-IL)>e
end
for j=1:M
temp=0;
for k=1:N
temp = temp+((Pyc(k,j))*log((Pyc(k,j))/Qy(k)));
end
F(j)=exp(temp);
end
x=F*Pc;
IL=log2(x)
Iu=log2(max(F));
If (Iu - IL)<e
Cc=IL;
Answers (1)
Voss
on 9 Dec 2021
These lines:
while (Iu-IL)>e
end
define an endless loop, according to the values of the variables Iu, IL, and e you have defined.
Categories
Find more on WLAN Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!