%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%% By SAJID BASHIR
%%%%%%%%%% MIMO DETECTION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clc
clear all
global ModulationScheme Tx Rx BitsPerSymbol H Amp Y Const_dB MM Range_R Range_I;
Packet_Size = [100]; %number of bits per packet
RED = '--ro';BLACK = '--ko';GREEN = '--go';BLUE = '--bo';
LEGEND1 = ['ML'];LEGEND2 = ['ZF'];LEGEND3 = ['VBLAST'];LEGEND4 = ['SPHERE'];
X_LABEL = ['Eb/No'];Y_LABEL = ['BER'];
LINE_COLOR = [BLUE;BLACK;RED;GREEN;];
LEGEND_UPPER_RIGHT = 1;LEGEND_UPPER_LEFT = 2;LEGEND_LOWER_LEFT = 3;LEGEND_LOWER_RIGHT = 4;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ModulationScheme = [4]; Tx = [2]; Rx = [2];
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Eb_No_MIN = 0; Eb_No_INC = 5; Eb_No_MAX = 40;
Energies_dB = Eb_No_MIN:Eb_No_INC:Eb_No_MAX; %convert energy ib decibel to normal energy
Length_Energy_Loop = size(Energies_dB,2); Energies = 10.^(Energies_dB./10);
for MM = 1:length(ModulationScheme)
BitsPerSymbol = log2(ModulationScheme(MM)); ML_SearchSpace(MM) = 2^ (Tx(MM) * BitsPerSymbol);
Const = dmodce(0:ModulationScheme(MM)-1,1,1,'qask',ModulationScheme(MM));
Range_R = unique(real(Const)); Range_I = unique(imag(Const));
[Data_Seq,Sym_Seq] = Sequence_Gen(Tx(MM),Const,ML_SearchSpace(MM),BitsPerSymbol);
itr(MM) = round(Packet_Size(MM) ./ BitsPerSymbol ./ Tx(MM)); %Number of Transmissions to send Packet Size
for Iteration = 1:itr(MM)
disp(['MM = ',int2str(MM),' Iteration = ',int2str(Iteration)]);
Data = randint(Tx(MM),1,ModulationScheme(MM));% Generate Data Stream
X = Const(Data+1).'; H = 0.5 * (randn (Rx(MM),Tx(MM)) + j*randn (Rx(MM),Tx(MM)));
Noise = 0.5 * (randn(size(H*X)) +j*randn(size(H*X)));
for EE = 1:Length_Energy_Loop% Start Of Energy Loop
Es = Energies(EE)./(Tx(MM));
Amp = sqrt(Es*0.5); XX = Amp*X;
Y = (H*XX + Noise); Sym_Seq_dB = Amp * Sym_Seq;
Const_dB = Amp * Const; randn('state',sum(100*clock));
%`````````````````````````````````ML DETECTOR``````````````````````````
[Data_ML,ML_Const] = ML_Detector(Tx(MM),Y,H,Const,ML_SearchSpace(MM),Data_Seq,Sym_Seq_dB);
Error_ML(EE,Iteration) = biterr(Data,Data_ML);
%```````````````````````````````````````ZFE````````````
[Data_ZF] = ZF_Detector();
Error_ZF(EE,Iteration) = biterr(Data,Data_ZF);
%````````````````````````````````````````````````` V_BLAST
[Data_V,X_V] = VBlast();
Error_VBlast(EE,Iteration) = biterr(Data,Data_V);
%`````````````````````````````````SPHERE DECODER``````````````````````````
[Data_Sphere] = SphereDecoder(Const_dB(Data_ZF + 1).');
Error_Sphere(EE,Iteration) = biterr(Data,Data_Sphere);
end%End of Energy Loop
end %End of Iteration
Bit_Error1(MM,:) = sum(Error_ML')./itr(MM)/(Tx(MM)*BitsPerSymbol);
Bit_Error2(MM,:) = sum(Error_ZF')./itr(MM)/(Tx(MM)*BitsPerSymbol);
Bit_Error3(MM,:) = sum(Error_VBlast')./itr(MM)/(Tx(MM)*BitsPerSymbol);
Bit_Error4(MM,:) = sum(Error_Sphere')./itr(MM)/(Tx(MM)*BitsPerSymbol);
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Plot the graphs
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
figure
TMP_COLOR = 1;
for MM = 1:length(ModulationScheme)
semilogy(Energies_dB,Bit_Error1(MM,:),LINE_COLOR(TMP_COLOR,:));TMP_COLOR = TMP_COLOR+1; hold on;
semilogy(Energies_dB,Bit_Error2(MM,:),LINE_COLOR(TMP_COLOR,:));TMP_COLOR = TMP_COLOR+1; hold on;
semilogy(Energies_dB,Bit_Error3(MM,:),LINE_COLOR(TMP_COLOR,:));TMP_COLOR = TMP_COLOR+1; hold on;
semilogy(Energies_dB,Bit_Error4(MM,:),LINE_COLOR(TMP_COLOR,:));TMP_COLOR = TMP_COLOR+1; hold on;
end
grid
legend(LEGEND1,LEGEND2,LEGEND3,LEGEND4,LEGEND_UPPER_RIGHT);
xlabel(X_LABEL);
ylabel(Y_LABEL);
阿里matlab建模师
- 粉丝: 4255
- 资源: 2843
最新资源
- 東耳篮球馆会员信息管理系统(编号:98721117).zip
- 房屋系统(编号:45266146).zip
- 大学生志愿者信息管理系统(编号:96654262).zip
- 房屋租赁系统(编号:49930163).zip
- 付费自习室管理系统(编号:46724236)(1).zip
- 学术论文撰写技巧:施一公提高英文论文写作能力的六点建议
- 科研真问题从何而来-中科院院士分享
- 通过matlab语言读取csv文件.zip
- 通过Django实现用户注册和登录的简单认证系统.zip
- 通过汇编语言计算两个整数和,将结果存储在另一个变量中.zip
- Aruba%20Instant%20On_2.3.0_apk-dl.com.apk.1.1
- Ruby参考手册中文CHM版最新版本
- RubyonRails字符串处理中文最新版本
- 基于 selenium 模拟微博登录爬虫资料齐全+详细文档+源码.zip
- 基于chromeDriver+selenium蓝桥杯题库爬虫资料齐全+详细文档+源码.zip
- 基于java+selenium爬虫资料齐全+详细文档+源码.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
- 1
- 2
- 3
- 4
前往页