資源簡介
協同通信 中繼選擇方案的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=?
- 上一篇:基于matlab的圖像融合
- 下一篇:MATLAB的地震正演程序
評論
共有 條評論