📄 comp_exam4_1.m
字号:
% Simulation the probability of more than N_errors in N symbol blocks in
% a digital communication system
%
N_sim = input('Enter number of repetitions or trials ');
N = input('Bit block size for simulation ');
N_errors = input('Simulate the probability of more than __ errors occurring ');
PE = input('Error probability on each bit ');
count = 0;
for n = 1:N_sim
U = rand(1, N);
Error = (-sign(U-PE)+1)/2; % Error array - elements are 1 for error; 0 otherwise
if sum(Error) > N_errors
count = count + 1;
end
if mod(n,1000) == 0
n
end
end
P_greater = count/N_sim
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -