• 大小: 6KB
    文件类型: .m
    金币: 1
    下载: 0 次
    发布日期: 2021-06-06
  • 语言: Matlab
  • 标签: 协同  中继选择  

资源简介

协同通信 中继选择方案的matlab仿真

资源截图

代码片段和文件信息

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%作者:cxj
%最后修改日期:2009.11.30
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clear 
close all
‘DF System‘
M=2;
type=1;
chan_len=400;   %channel length 40000

iteration=5;     %///20 10
blocks=20;
frames=50;
frame_len=256;
var_sr=1;   
var_sd=1;
var_rd=1;
N0=1; 
r=0.5;             %功率比r=Ps/P
snr=0:2:10;%%%%2:20


eps=1e-6;           %误差容限
threshhold=2; %协作门限
beta1=0.01; %估计误差
sel_type=1; %中继选择类型 1::无协作门限Max(min(snr))2:无协作门限Hamonic(snr) 3:协作门限 Max(min(SNR)) 4:协作门限 Hamonic(SNR)
            %0:无选择 8:非协作

%产生各个信道系数,复高斯信道
ch_coefficients_SD=F_wgn(chan_len10var_sd0);
ch_coefficients_SR11=F_wgn(chan_len10var_sr0);
ch_coefficients_RD12=F_wgn(chan_len10var_rd0);
ch_coefficients_SR21=F_wgn(chan_len10var_sr0);
ch_coefficients_RD22=F_wgn(chan_len10var_rd0);
ch_coefficients_SR31=F_wgn(chan_len10var_sr0);
ch_coefficients_RD32=F_wgn(chan_len10var_rd0);
ch_coefficients_SR41=F_wgn(chan_len10var_sr0);
ch_coefficients_RD42=F_wgn(chan_len10var_rd0);
errors=zeros(35length(snr));

for detect_type= 1:3 %ZF=1;MMSE=2;ML=3;
   detect_type=detect_type
    for relay_protocal=1:5 % 1:DF-MRC 2:DF C-MRC 3:DF-SC 4:AF MRC 5:AF SC
        for i=1:length(snr)
           % snr(i)
            chan_total=0;    %channel inc
            P=N0*10^(snr(i)/10);
            P1=P*r;   %S-RS-D
            P2=P-P1;     %R-D
%             P1=P;P2=P;
            for m=1:iteration
                for k=1:blocks
                   for l=1:frames
                       chan_total=chan_total+1;
                       i_idx=mod(chan_total - 1chan_len)+1;
                       H=[ch_coefficients_SR11(i_idx) ch_coefficients_RD12(i_idx);
                           ch_coefficients_SR21(i_idx) ch_coefficients_RD22(i_idx);
                           ch_coefficients_SR31(i_idx) ch_coefficients_RD32(i_idx);
                           ch_coefficients_SR41(i_idx) ch_coefficients_RD42(i_idx)];       %信道矩阵,4个中继
                       H_SD=ch_coefficients_SD(i_idx);
                       data_source=randint(frame_len1M);
                       data_mod=pskmod(data_sourceM);         %psk调制
                       Pa=P1;
                       Pb=P2;
                       SD_in=sqrt(Pa).*data_mod;                                   %信源发射信号
                       n_SD=wgn(frame_len1N0‘complex‘‘linear‘);
                       SD_in= channel_SD(SD_inH_SDn_SD);                        %SD链路目的端接收信号                               
                       [H_SRH_RD]=RelaySelection(Hsel_typePaPbN0threshhold);   %中继选择,选择一个最佳中继
                       SR_in=sqrt(Pa).*data_mod;                                 %信源发射信号
                       n_SR=wgn(frame_len1N0‘complex‘‘linear‘);              %SR信道噪声
                       SR_in= 

评论

共有 条评论