comp_exam8_4.m

来自「the source code of Ziemer s book Digital」· M 代码 · 共 36 行

M
36
字号
%	Bit error probabilities for binary BPSK, CFSK, DPSK, NFSK in Rayleigh fading
%	compared with same in nonfading
%
clf
mod_type = input('Enter modulation type: 1 = BPSK; 2 = DPSK; 3 = CFSK; 4 = NFSK ');
z_dB = 0:.3:30;
z = 10.^(z_dB/10);
if mod_type == 1
   P_E_nf = qfn(sqrt(2*z));
   P_E_f = 0.5*(1-sqrt(z./(1+z)));
elseif mod_type == 2
   P_E_nf = 0.5*exp(-z);
   P_E_f = 0.5./(1+z);
elseif mod_type == 3
   P_E_nf = qfn(sqrt(z));
   P_E_f = 0.5*(1-sqrt(z./(2+z)));
elseif mod_type == 4
	P_E_nf = 0.5*exp(-z/2);
   P_E_f = 1./(2+z);
end
semilogy(z_dB,P_E_nf,'-'),axis([0 30 10^(-6) 1]),xlabel('E_b/N_0, dB'),ylabel('P_E'),...
hold on
grid
semilogy(z_dB,P_E_f,'--')
if mod_type == 1
   title('BPSK')
elseif mod_type == 2
   title('DPSK')
elseif mod_type == 3
   title('Coherent BFSK')
elseif mod_type == 4
   title('Noncoherent BFSK')
end
legend('No fading','Rayleigh Fading',1)

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?