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!