SCMA中的消息传递算法MPA仿真程序.txt

上传人:b****3 文档编号:2487715 上传时间:2022-10-30 格式:TXT 页数:3 大小:5.04KB
下载 相关 举报
SCMA中的消息传递算法MPA仿真程序.txt_第1页
第1页 / 共3页
SCMA中的消息传递算法MPA仿真程序.txt_第2页
第2页 / 共3页
SCMA中的消息传递算法MPA仿真程序.txt_第3页
第3页 / 共3页
亲,该文档总共3页,全部预览完了,如果喜欢就下载吧!
下载资源
资源描述

SCMA中的消息传递算法MPA仿真程序.txt

《SCMA中的消息传递算法MPA仿真程序.txt》由会员分享,可在线阅读,更多相关《SCMA中的消息传递算法MPA仿真程序.txt(3页珍藏版)》请在冰豆网上搜索。

SCMA中的消息传递算法MPA仿真程序.txt

function[X,repeat_times]=MPA(y,sigma2)

%��ʼ������

X=zeros(6,2);

Lx=zeros(4,24);

Ly=zeros(4,24);

itera_max=10;%����������

itera_count=0;

L_getx=zeros(1,4);

L_gety=zeros(3,4);

rota_angle=[1,exp(1i*2*pi/3),exp(1i*4*pi/3)];

F=[111000;100110;010101;001011];

forrow_index=1:

4

r=1;

forcolumn_index=1:

6

ifF(row_index,column_index)==1

F(row_index,column_index)=rota_angle(r);

r=r+1;

end

end

end

globalcdbook1cdbook2

cdbook1=[0.4472+1.3416*1i,1.3416-0.4472*1i,-1.3416+0.4472*1i,-0.4472-1.3416*1i];

cdbook2=[1.3416+0.4472*1i,0.4472-1.3416*1i,-0.4472+1.3416*1i,-1.3416-0.4472*1i];%00100111

%cdbook=[-1-1i,1-1i,-1+1i,1+1i];

c4=de2bi(0:

3);%00100111

%map=[111000;200110;020201;002022];

fork1=1:

4

fork2=1:

6

ifF(k1,k2)~=0

Ly(k1,(k2-1)*4+1)=0.25;

Ly(k1,(k2-1)*4+2)=0.25;

Ly(k1,(k2-1)*4+3)=0.25;

Ly(k1,(k2-1)*4+4)=0.25;

end

end

end

%X_before2=zeros(1,12);

X_before1=ones(1,12);

X=X_before1-1;

%������

foritera_count=1:

itera_max

%*******************************����Lx*****************************

forrow_index=1:

4

x_loca=find(F(row_index,:

));%���ÿһ�з���λ�ã�����y�й�ϵ��x

fort=1:

3

column_index=x_loca(t);

ent_k=[123];

ent_k(t)=[];

fork=1:

3%�˺�����λ��

L_gety(k,1)=Ly(row_index,(x_loca(k)-1)*4+1);

L_gety(k,2)=Ly(row_index,(x_loca(k)-1)*4+2);

L_gety(k,3)=Ly(row_index,(x_loca(k)-1)*4+3);

L_gety(k,4)=Ly(row_index,x_loca(k)*4);

end

%�����ĸ�����ֵ,3��x��64�ַ��ŵ�ȫ����

x_map=zeros(1,3);

forx_k=1:

4%��ǰ���xk����Ӧt

x_map(t)=const_map(x_k,row_index,x_loca(t));%����ӳ��

fork2=1:

4

x_map(ent_k

(1))=const_map(k2,row_index,x_loca(ent_k

(1)));%����ӳ��

fork3=1:

4

x_map(ent_k

(2))=const_map(k3,row_index,x_loca(ent_k

(2)));%����ӳ��

x_map_rota=x_map.*rota_angle;

y_map=sum(x_map_rota);

temp=L_gety(ent_k

(1),k2)*L_gety(ent_k

(2),k3);

dif_y(k2,k3)=y(row_index)-y_map;

Lx_xk_temp(k2,k3)=temp*exp(-0.5/sigma2*(abs(dif_y(k2,k3)))^2);

end

end

Lx(row_index,(column_index-1)*4+x_k)=sum(sum(Lx_xk_temp));

end

%��׼��normalization

lamada=1/(Lx(row_index,(column_index-1)*4+1)+Lx(row_index,(column_index-1)*4+2)+Lx(row_index,(column_index-1)*4+3)+Lx(row_index,(column_index-1)*4+4));

Lx(row_index,(column_index-1)*4+1)=lamada*Lx(row_index,(column_index-1)*4+1);

Lx(row_index,(column_index-1)*4+2)=lamada*Lx(row_index,(column_index-1)*4+2);

Lx(row_index,(column_index-1)*4+3)=lamada*Lx(row_index,(column_index-1)*4+3);

Lx(row_index,(column_index-1)*4+4)=lamada*Lx(row_index,(column_index-1)*4+4);

end

end

%***********************����Ly****************************************

forcolumn_index=1:

6

y_loca=find(F(:

column_index))';%����ת�����ÿһ�з���λ�ã�����x�й�ϵ��y

fort=1:

2

row_index=y_loca(t);

%�����ĸ�����ֵ

fork=1:

2

ifk~=t

L_getx

(1)=Lx(y_loca(k),(column_index-1)*4+1);

L_getx

(2)=Lx(y_loca(k),(column_index-1)*4+2);

L_getx(3)=Lx(y_loca(k),(column_index-1)*4+3);

L_getx(4)=Lx(y_loca(k),(column_index*4));

end

end

fork1=1:

4

Ly(row_index,(column_index-1)*4+k1)=L_getx(k1);

end

%������б�׼��

lamada=1/(Ly(row_index,(column_index-1)*4+1)+Ly(row_index,(column_index-1)*4+2)+Ly(row_index,(column_index-1)*4+3)+Ly(row_index,(column_index-1)*4+4));

Ly(row_index,(column_index-1)*4+1)=lamada*Ly(row_index,(column_index-1)*4+1);

Ly(row_index,(column_index-1)*4+2)=lamada*Ly(row_index,(column_index-1)*4+2);

Ly(row_index,(column_index-1)*4+3)=lamada*Ly(row_index,(column_index-1)*4+3);

Ly(row_index,(column_index-1)*4+4)=lamada*Ly(row_index,(column_index-1)*4+4);

end

end

end

%***********************�ж�һ��X***********************

fort=1:

6

y_loca=find(F(:

t));

p00=Lx(y_loca

(1),(t-1)*4+1)*Lx(y_loca

(2),(t-1)*4+1);

p10=Lx(y_loca

(1),(t-1)*4+2)*Lx(y_loca

(2),(t-1)*4+2);

p01=Lx(y_loca

(1),(t-1)*4+3)*Lx(y_loca

(2),(t-1)*4+3);

p11=Lx(y_loca

(1),(t-1)*4+4)*Lx(y_loca

(2),(t-1)*4+4);

p=[p00,p10,p01,p11];

%[~,K]=max(p);

%X_judge(t,:

)=c4(K,:

);

X_judge_out(t,:

)=[log((p10+p11)/(p01+p00)),log((p01+p11)/(p10+p00))];

end

%X=reshape(X_judge',1,12);

%ifitera_count>1

%ifX_before1==X

%repeat_times=itera_count;

%itera_count=itera_max;

%%end

%elseifitera_count==itera_max

%repeat_times=itera_max;

%end

%end

%end

%end

repeat_times=10;

X=reshape(X_judge_out',1,12);

end

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 解决方案 > 工作计划

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1