C114门户论坛百科APPEN| 举报 切换到宽版

亚星游戏官网

 找回密码
 注册

只需一步,快速开始

短信验证,便捷登录

搜索
查看: 13379|回复: 0

NOMA [复制链接]

军衔等级:

亚星游戏官网-yaxin222  新兵

注册:2022-4-22
发表于 2023-4-27 10:32:43 |显示全部楼层
NOMA下行两用户的误码率matlab基础仿真代码:
  1. clc; clear variables; close all;

  2. N = 10^5;               %Number of monte carlo simulations
  3. SNR = 0:30;             %SNR range in dB
  4. snr = db2pow(SNR);      %SNR range in linear scale

  5. %Generate random data bits for transmission
  6. x1 = randi([0 1],1,N);  %Data bits of user 1
  7. x2 = randi([0 1],1,N);  %Data bits of user 2

  8. %Do BPSK modulation of data
  9. xmod1 = 2*x1 - 1;
  10. xmod2 = 2*x2 - 1;

  11. %Set power weights for users
  12. a1 = 0.75; a2 = 0.25;

  13. %Do superposition coding
  14. x = sqrt(a1)*xmod1 + sqrt(a2)*xmod2;

  15. %Add AWGN to x (Transmit x through an AWGN channel)
  16. for u = 1:length(snr)
  17.     y1 = awgn(x,SNR(u),'measured');  %Received signal at user 1 corrupted by AWGN
  18.     y2 = awgn(x,SNR(u),'measured'); %Received signal at user 2 corrupted by AWGN
  19.    
  20.     %AT USER 1
  21.     %Direct decoding of x from y1
  22.     x1_hat = ones(1,N); %just a buffer
  23.     x1_hat(y1 < 0) = 0;
  24.    
  25.     %AT USER 2
  26.     %Direct decoding of x from y2
  27.     x11_est = ones(1,N); %just a buffer
  28.     x11_est(y2 < 0) = 0; %Estimate user 1's signal first
  29.     x11_est(x11_est == 0) = -1; %Remodulate user 1's signal
  30.     %Subtract remodulated x11_est component from y2
  31.     rem = y2 - sqrt(a1)*x11_est;
  32.    
  33.     %Decode x2 from rem
  34.     x2_hat = zeros(1,N);
  35.     x2_hat(rem>0) = 1;
  36.    
  37.     %Estimate BER
  38.     ber1(u) = biterr(x1,x1_hat)/N;
  39.     ber2(u) = biterr(x2,x2_hat)/N;
  40. end

  41. %plot BER curves
  42. semilogy(SNR, ber1, 'linewidth', 1.5); hold on;
  43. semilogy(SNR, ber2, 'linewidth', 1.5); grid on;
  44. legend('User 1 \alpha_1 = 0.75','User 2 \alpha_2 = 0.25');
  45. xlabel('SNR (dB)');
  46. ylabel('BER');
  47. title('BER graph for NOMA in AWGN channel');
复制代码


举报本楼

您需要登录后才可以回帖 登录 | 注册 |

手机版|C114 ( 沪ICP备12002291号-1 )|联系大家 |网站地图  

GMT+8, 2024-11-10 14:50 , Processed in 0.117847 second(s), 15 queries , Gzip On.

Copyright © 1999-2023 C114 All Rights Reserved

Discuz Licensed

回顶部
XML 地图 | Sitemap 地图