📄 time_fad.m
字号:
% Create Rayleigh fading channel object.
chan = rayleighchan(1/10000,500);
% Generate data and apply fading channel.
M = 2; % DBPSK modulation order
tx = randint(50000,1,M); % Random bit stream
dpskSig = dpskmod(tx,M); % DPSK signal
fadedSig = filter(chan,dpskSig); % Effect of channel
chan %Display Channel Properties
% Compute error rate for different values of SNR.
SNR = 0:2:20; % Range of SNR values, in dB.
for n = 1:length(SNR)
rxSig = awgn(fadedSig,SNR(n)); % Add Gaussian noise.
rx = dpskdemod(rxSig,M); % Demodulate.
% Compute error rate.
% Ignore first sample because of DPSK initial condition.
[nErrors, BER(n)] = biterr(tx(2:end),rx(2:end));
end
% Compute theoretical performance results, for comparison.
BERtheory = berfading(SNR,'dpsk',M,1);
% Plot BER results.
semilogy(SNR,BERtheory,'b-',SNR,BER,'r*');
legend('Theoretical BER','Empirical BER');
xlabel('SNR (dB)'); ylabel('BER');
title('Binary DPSK over Rayleigh Fading Channel');
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -