The infinity while loop
古いコメントを表示
The codes below are having an infinity loop. If I change the while function to if function, it only give one value. What should I change to get a results to plot a graph?
q=1.6e-19; % Charge of Electron
Ib=202e-6; % Background Noise Current + Interference
N0=2*q*Ib; % Noise Spectral Density
R=1; % Photodetector responsitivity
Rb=1e6; % Bit rate
Tb=1/Rb; % Bit duration
sig_length=ceil(20e-3/Tb); % Number of bits
nsamp=10; % Samples per symbols
Tsamp=Tb/nsamp; % Sampling time
EbN0_db=30; % Signal-to-noise ratio in dB
BER=1; % Initializing ber
index=1;
maxerr=30; % Maximum error per simulation
while (BER>1E-4)
terr=0; % Total error
tsym=0; % Total bits
SNR=10.^(EbN0_db./10); % Signal-to-noise ratio
P_avg=sqrt(N0*Rb*SNR/(2*R^2)); % Average transmitted optical power
end;
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Just for fun についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!