本文主要是介绍基于Matlab实现BPSK、QPSK 和 16QAM 调制的循环前缀和直接序列扩频(Matlab代码实现),希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
目录
💥1 概述
📚2 运行结果
🎉3 参考文献
👨💻4 Matlab代码
💥1 概述
该项目的目的是模拟不同调制方案(BPSK,QPSK,16QAM)的OFDM系统,无需编码,并使用(1/3)重复编码。
用于瑞利平坦衰落通道和频率选择性衰落通道。
📚2 运行结果
主函数部分代码:
clc, clear, close all % Generate Random Bit stream bk L = 1e6; Eb_BPSK = 1; bk = randi([0 1], 1, L);% Generate BPSK symbols based on the bit stream xk xk = bk; xk(xk == 1) = sqrt(Eb_BPSK); xk(xk == 0) = -sqrt(Eb_BPSK);% Generate the complex channel vector and complex noise vector N = 1:10; N0 = Eb_BPSK ./ (10 .^ (N ./ 10)); % assumption BER_v = zeros(1, 10); SNR = zeros(1, 10); for i = 1:10hr = normrnd(0, sqrt(0.5), 1, L);hi = normrnd(0, sqrt(0.5), 1, L);channel_BPSK = hr + 1j * hi;nc = normrnd(0, sqrt(N0(i) / 2), 1, L);ns = normrnd(0, sqrt(N0(i) / 2), 1, L);Noise_BPSK = nc + 1j * ns;% Compute the received symbol vector ykyk = channel_BPSK .* xk + Noise_BPSK;% Compensate for the channel gain at the receiverbk_telda = yk ./ channel_BPSK; bk_telda(bk_telda > 0) = 1;bk_telda(bk_telda < 0) = 0;% Compute the bit-error rate (BER) for SNRBER = 0;for n = 1:Lif(bk_telda(n) ~= bk(n))BER = BER + 1;elsecontinue;endendBER_v(i) = BER / L;SNR(i) = 10 * log10(Eb_BPSK / N0(i)); end semilogy(SNR, BER_v); title('BER vs. SNR for BPSK before repetition'); xlabel('SNR (dB)'); ylabel('BER'); grid on; hold on;% % Theoritacl Calculation % BER_TH = zeros(length(N), 20); % BER_TH(:, 1) = berfading(N, 'psk', 4, 1); % semilogy(N, BER_TH) % legend('Practical BER','Theoritical BER')%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Repeat the code clc, clear % Generate Random Bit stream bk L = 1e6; Eb_BPSK = 1; bk = randi([0 1], 1, L);% Generate BPSK symbols based on the bit stream xk xk = bk; xk(xk == 1) = sqrt(Eb_BPSK); xk(xk == 0) = -sqrt(Eb_BPSK); xk_rep = repelem(xk, 3); xk_ver = zeros(1, L); BER_ver = zeros(1, 10); % Generate the complex channel vector and complex noise vector N = 1:10; N0 = Eb_BPSK ./ (10 .^ (N ./ 10)); % assumption SNR = zeros(1, 10); for i = 1:10hr = normrnd(0, sqrt(0.5), 1, 3 * L);hi = normrnd(0, sqrt(0.5), 1, 3 * L);channel_BPSK = hr + 1j * hi;nc = normrnd(0, sqrt(N0(i) / 2), 1, 3 * L);ns = normrnd(0, sqrt(N0(i) / 2), 1, 3 * L);Noise_BPSK = nc + 1j * ns;% Compute the received symbol vector ykyk = channel_BPSK .* xk_rep + Noise_BPSK;% Compensate for the channel gain at the receiverbk_telda = yk ./ channel_BPSK; bk_telda(bk_telda > 0) = 1;bk_telda(bk_telda < 0) = 0;% make the decsioncounter = 1;for j = 1:3:3*Lif((bk_telda(j) + bk_telda(j+1) + bk_telda(j+2)) > 1)xk_ver(counter) = 1;elsexk_ver(counter) = 0;endcounter = counter + 1;end
🎉3 参考文献
[1]于江,王春岭,沈刘平,张磊.扩频通信技术原理及其应用[J].中国无线电,2010(03):44-47.
部分理论引用网络文献,若有侵权联系博主删除。
这篇关于基于Matlab实现BPSK、QPSK 和 16QAM 调制的循环前缀和直接序列扩频(Matlab代码实现)的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!