?? fading channel.m
字號:
% Create Rayleigh fading channel object.
chan = rayleighchan(1/10000,100);
% 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
% 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 + -