資源簡介
matlab代碼仿真,空間調制技術的仿真基礎代碼。空間調制的建模。

代碼片段和文件信息
%?SM?simulation
%?Nt?Transmit?Antenna
%?Nr?Receive?Antenna
%?M??QAM?Modulation
%?no?bit/s/Hz?Transmission
clc
clear?all
close?all
Num?=?100;
M?=?4;????????????????????????????????????????????????????????????????%?Modulation?order
Nt?=4;?????????????????????????????????????????????????????????????????%?Tx?antennas
Nr?=?4;????????????????????????????????????????????????????????????????%?Rx?antennas
k0?=?log2(M);?????????????????????????????????????????????????????%?bits?per?symbol
no?=?k0?+?log2?(Nt);???????????????????????????????????????????%?bit/s/Hz?Transmission
detection_s=0;
dec_choose=0;
Es_N0_dB?=?[-4:2:4];??????????????????????????????????????????????%??the?signal-to-noise?ratio
symbol=qammod([0:M-1]?M);???????????????????????%Modulation?constellation
symbol.‘;
E=norm(symbol)^2/M;
SER2(1?length(Es_N0_dB))?=?zeros;
symbol_errors2?=?zeros(length(Es_N0_dB)1);
y?=zeros(Nr1);
for?xx=1:length(Es_N0_dB)
????xx
????sigma?=?10^(-Es_N0_dB(xx)/20);
????for?a=1:Num
????????%==========================================================================
????????bin_ip?=randint(1?no);???????????????????????????????%?Generate?Binary?Input
????????dec_ip?=?0;
????????for?aa=1:no????????????????????????????????????????????????%?Convert?to?Decimal?Input
????????????if?bin_ip(aa)==?1
????????????????dec_ip?=?dec_ip?+?2^(no-aa);
????????????end
????????end
????????%===================================================================
????????%Spatial?Modulation?Mapper:??transmitter?
????????%===================================================================
????????for?i=1:log2(Nt)?????????????????????????????????????????%The?selected?transmit?antenna?index
????????????bin_choose(i)=bin_ip(i);
????????end
????????dec_choose=0;
????????for?aa=1:length(bin_choose)??????????????????????%?Convert?the?selected?transmit?antenna?index?to?Decimal
????????????if?bin_choose(aa)==?1
????????????????dec_choose?=?dec_choose?+?2^(log2(Nt)-aa);
????????????end
????????end
????????tx_ant_no=dec_choose+1;
????????offset=mod(dec_ip?M);
????????x?=?zeros(Nt?1);
????????x(tx_ant_no)?=?symbol(offset?+?1);
????????
????????%===================================================================
????????%?The?channel?
????????%==================================================================
????????n?=?(1/sqrt(2))*(randn(Nr1)+sqrt(-1)*randn(Nr1));???%?white?Gaussian?Noise?0dB?variance
????????H?=?(1/sqrt(2))*(randn(Nr?Nt)?+?sqrt(-1)*randn(Nr?Nt));
????????y?=?H*x?+sqrt(E)*sigma*n;
????????
????????%=================================================================
????????%?ML???Optimal?Detection?Scheme
????????%=================================================================
????????p?=1;
????????for?b=1:Nt
????????????for?aa=1:M
????????????????g?=?H(:b)*symbol(aa);
????????????????g_f?=?0;
????????????????for?w=1:Nr
????????????????????g_f?=?(abs(g(w)))^2?+?g_f;
????????????????end
??????
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????4178??2015-03-07?13:40??SMMLdetector_QAM.m
-----------?---------??----------?-----??----
?????????????????4178????????????????????1
- 上一篇:萬用表仿真
- 下一篇:空間調制技術編程代碼
評論
共有 條評論