# 【OFDM仿真】基于秩亏情况下遗传算法和粒子群算法优化MIMO-OFDM系统多用户检测附matlab代码

✅作者简介：热爱科研的Matlab仿真开发者，修心和技术同步精进，matlab项目合作可私信。

🍎个人主页：Matlab科研工作室

🍊个人信条：格物致知。

## ⛄ 部分代码

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%   秩亏情况下MIMO-OFDM系统多用户检测MMSE-GA-GSAA算法仿真   %%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%  说明  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%通信系统：通过第l个用户传输的复信号s(l)是零均值的，方差为（lou）。

%加性高斯白噪声信号n(p)也是零均值的，其方差为（lou）。

%不同接收者或用户的频域信道传递函数Hpl是相互独立的,满足零均值单位方差的高斯分布。

%%%%%%%%%%%  GA  %%%%%%%%%%%%%%%

%GA过程：从适应度大的个体中取出Nm/2个体，用赌盘选择法（选择算子）随机选择

%Nm/2次（每次一个个体），得到Nm/2个个体组成杂交集合，将杂交集合中个体与适

%应度函数值小的个体根据杂交概率进行杂交操作（两点杂交法），然后根据变异算子

disp('===============  作图  ===============')

%%%   作图   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

figure(1); %源信号

plot(source,'.');%源信号个数、0/1分布、信源

axis([1 100 -0.1 1.1]);title('Source transmitted in the Last Channel');

xlabel('Numbers of Signal');ylabel('0/1 Distribution');

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

figure(2);

subplot(1,2,1);%接收到的各路信号(不同SNR)

f13=1:1:Ni; %坐标

for f14=1:1:P

plot3(real(x(f14,:)),imag(x(f14,:)),f13,'x');%hold on;

end;

%plot3(real(x(1,:)),imag(x(1,:)),f13,'rx');hold on;

%plot3(real(x(2,:)),imag(x(2,:)),f13,'bx');hold on;

%plot3(real(x(3,:)),imag(x(3,:)),f13,'gx');hold on;

d1=real(x);  %x实部

d2=imag(x);  %x虚部

d31=min(min(d1));

d32=max(max(d1));

d41=min(min(d2));

d42=max(max(d2));

axis([d31 d32 d41 d42 0 Ni]);title('Received Signals of P-Antennas');

xlabel('Real');ylabel('Imaginary');zlabel('Numbers=Nm');

grid on;

figure(2);  %加噪声信号  *

subplot(1,2,2);

f13=1:1:Ni; %坐标

for f14=1:1:P

plot3(real(x(f14,:)),imag(x(f14,:)),f13,'x');%hold on;

end;

%plot3(real(x(1,:)),imag(x(1,:)),f13,'-rx');hold on;

%plot3(real(x(2,:)),imag(x(2,:)),f13,'-bx');hold on;

%plot3(real(x(3,:)),imag(x(3,:)),f13,'-gx');hold on;

axis([d31 d32 d41 d42 0 10]);%信号实部、信号虚部、个数

xlabel('Real');ylabel('Imaginary');zlabel('Numbers=Nm/10');

grid on;

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

figure(3);

subplot(1,2,1);

f13=1:1:Ni; %坐标

for f14=1:1:P

plot3(real(Smmse(f14,:)),imag(Smmse(f14,:)),f13,'.');hold on;

end

%plot3(real(Smmse(1,:)),imag(Smmse(1,:)),f13,'rx');hold on;

%plot3(real(Smmse(2,:)),imag(Smmse(2,:)),f13,'bx');hold on;

%plot3(real(Smmse(3,:)),imag(Smmse(3,:)),f13,'gx');hold on;

%plot3(real(Smmse(4,:)),imag(Smmse(4,:)),f13,'yx');hold on;

xlabel('Real');ylabel('Imaginary');zlabel('Numbers');

d1=real(Smmse);  %x实部

d2=imag(Smmse);  %x虚部

d31=min(min(d1));

d32=max(max(d1));

d41=min(min(d2));

d42=max(max(d2));

axis([d31 d32 d41 d42 0 Ni]);grid on;

figure(3);  %加噪声信号  *

subplot(1,2,2);

f13=1:1:Ni; %坐标

for f14=1:1:P

plot3(real(Smmse(f14,:)),imag(Smmse(f14,:)),f13,'.');hold on;

end;

%plot3(real(Smmse(1,:)),imag(Smmse(1,:)),f13,'rx');hold on;

%plot3(real(Smmse(2,:)),imag(Smmse(2,:)),f13,'bx');hold on;

%plot3(real(Smmse(3,:)),imag(Smmse(3,:)),f13,'gx');hold on;

%plot3(real(Smmse(4,:)),imag(Smmse(4,:)),f13,'yx');hold on;

xlabel('Real');ylabel('Imaginary');zlabel('Numbers');

axis([d31 d32 d41 d42 Ni/10-1 Ni/10+1]);grid on;

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

m11=1:1:Nm;%GA算法第一代种群

figure (4);subplot(2,1,1);plot(m11,AFc,'-x');axis([0 100 0 0.2]);

ylabel('Values of AF');

title('Adaptive Function(AF) of The 1st GA Generation');grid on;

figure (4);subplot(2,1,2);plot(m11,OFcz,'-o');axis([0 100 0 0.2]);

xlabel('Numbers of Individuals in a GA Population');ylabel('Values of OF');

title('Object Function(OF) of The 1st GA Generation');grid on;

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

m11=1:1:Nm;

figure (5);%GA算法第Ng代种群

subplot(2,1,1);plot(m11,AF,'-x');axis([0 100 0 20]);ylabel('Values of AF');

title('Adaptive Function(AF) of The Ng-st GA Generation');grid on;

figure (5);subplot(2,1,2);plot(m11,OFz,'-o');axis([0 100 0 20]);

xlabel('Numbers of Individuals in a GA Population');ylabel('Values of OF');

title('Object Function(OF) of The Ng-st GA Generation');grid on;

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

m12=1:1:Nm/2;

figure (6); %ph：存活概率

subplot(2,1,1);plot(m12,ph,'x');ylabel('Probability Values');

title('Survived Probability of Hybrid Assembly');grid on;

figure (6);%plj:累积概率

subplot(2,1,2);plot(m12,plj,'.');axis([0 Nm/2 0 1]);grid on;

xlabel('Numbers of Selected Individuals');ylabel('Probability Values');

title('Accumulated Probability of Hybrid Assembly');

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

m11=1:1:Nm;

figure (7);%%%%%%%%%%%%

subplot(2,1,1);plot(m11,AFx,'-x');axis([0 100 0 60]);

ylabel('Values of AF'); %适应度函数值 AF

title('Adaptive Function(AF) of The New GA Generation');grid on;

figure (7);%%%%%%%%%%%%

subplot(2,1,2);plot(m11,OFxz,'-o');axis([0 100 0 60]);

xlabel('Numbers of Individuals in a GA Population'); %遗传种群个体数

ylabel('Values of OF'); %目标函数值 OF

title('Object Function(OF) of The New GA Generation');grid on;

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

figure(8);%%%%%%%%%%%%

plot(pjs,'x');title('Meteopolis Formula');

xlabel('Numbers of Signal');ylabel('Probability Distribution');

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

figure(9);subplot(2,1,1);hold on; snr=1:1:10; plot(snr,ave1,'-o');hold on;

xlabel('SNR/dB');ylabel('BER');title('SNR-BER in a GA Generation');

figure(9); snr=1:1:10; subplot(2,1,2);plot(snr,ave1,'-o');hold on;

xlabel('SNR/dB');ylabel('BER');

title('SNR-BER of GA Operation in Once Generation');plot(snr,ave2,'-r*');

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

figure(10); subplot(2,1,1); snr=1:1:10; plot(snr,ave0,'-o');hold on;

xlabel('SNR/dB');ylabel('BER');title('SNR-BER of MMSE and GA Algorithm');

plot(snr,ave3,'-r*');legend('MMSE','GA');hold on;

figure(10);subplot(2,1,2);snr=1:1:10; plot(snr,ave3,'-r*');hold on;

xlabel('SNR/dB');ylabel('BER');title('SNR-BER of GA and GSAA Algorithm');

plot(snr,ave4,'-k^');legend('GA','GSAA');hold on;

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%figure(11); snr=1:1:10; plot(snr,ave0,'-o');hold on;

%plot(snr,ave3,'-r*');hold on;xlabel('SNR/dB');ylabel('BER');

%title('SNR-BER of MMSE/GA/GSAA Algorithm');

%plot(snr,ave4,'-k^');legend('MMSE','GA','GSAA');hold on;

figure(11); %%%%%%%%%%%%

snr=1:1:10; plot(snr,ave0,'-o');hold on;

%plot(snr,ave3,'-r*');hold on;

xlabel('SNR/dB');ylabel('BER');

title('SNR-BER of MMSE/HGA(GSAA) Algorithm');

plot(snr,ave4,'-k^');legend('MMSE','HGA');hold on;

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

figure(12); snr=1:1:10; plot(snr,yp0,'-o');hold on;

%plot(snr,yp3,'-r*');hold on;

xlabel('SNR/dB');ylabel('BER');

title('SNR-BER of MMSE/HGA(GSAA) Algorithm');

plot(snr,yp4,'-k^');legend('MMSE','HGA');hold on; grid on

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

figure(13);%%%%%%%%%%%%

m22=1:1:Ng;rx=mean(rfs);hold on;plot(m22,rx,'-o'); %相关系数

title('Correlation Coefficient of Genetic Operators');grid on;

xlabel('Times of Genetic Generation');ylabel('Correlation Coefficient');

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

disp('===============  figure(12)  ===============')

toc

disp('--------------------------------------------')

disp('=============  HGA程序运行结束  =============')

disp('--------------------------------------------')

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

## ⛄ 参考文献

[1]杨光达, 胡封晔, 侯金凤. 基于混合遗传算法的MIMO-OFDM系统多用户检测研究[C]// 中国电子学会第十六届信息论学术年会. 0.

|
5天前
|

37 12
|
8天前
|

38 20
|
8天前
|

40 19
|
7天前
|

50 16
|
9天前
|

23 2
|
10天前
|

25 3
|
10天前
|

32 1
|
1天前
|

8 0
|
26天前
|

40 2
|
26天前
|

42 1